SlideShare a Scribd company logo
#mstechdays techdays.microsoft.fr
Agenda
• Introduction: evolution of C#
• C# 6.0
• Getter-only auto-properties
• Initializers for auto-properties
• Using static classes
• String interpolation
• Expression-bodied methods
• Expression-bodied properties
• Index initializers
• Null-conditional operator
• Nameof operator
• Exception filter
• Q&A
The Evolution of C#
C# 1.0
C# 2.0
C# 3.0
Managed Code
Generics
Language Integrated Query
C# 4.0
Dynamic Programming
C# 5.0
Asynchrony (await)
.Net Compiler Platform: Roslyn
•INTRODUCTION
•EXPOSING THE COMPILER APIS
• COMPILER PIPELINE FUNCTIONAL AREAS
• API LAYERS
• Compiler APIs
• Workspaces APIs
•WORKING WITH SYNTAX
• SYNTAX TREES
• SYNTAX NODES
• SYNTAX TOKENS
• SYNTAX TRIVIA
• SPANS
• KINDS
• ERRORS
•WORKING WITH SEMANTICS
• COMPILATION
• SYMBOLS
• SEMANTIC MODEL
•WORKING WITH A WORKSPACE
• WORKSPACE
• SOLUTIONS, PROJECTS, DOCUMENTS
•SUMMARY
Getter-only auto-properties
public class Point
{
public int X { get; set; }
public int Y { get; set; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Getter-only auto-properties
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Getter-only auto-properties
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Initializers for auto-properties
public class Point
{
public int X { get; } = 5;
public int Y { get; } = 7;
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Using static classes
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Using static classes
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Math.Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
Using static classes
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
String interpolation
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return String.Format("({0}, {1})", X, Y);
}
}
String interpolation
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return "({X}, {Y})";
}
}
Expression-bodied methods
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return "({X}, {Y})";
}
}
Expression-bodied methods
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString()
{
return "({X}, {Y})";
}
}
() => { return "({X}, {Y})"; }
() => "({X}, {Y})"
Expression-bodied methods
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString() => "({X}, {Y})";
}
Expression-bodied properties
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist
{
get { return Sqrt(X * X + Y * Y); }
}
public override string ToString() => "({X}, {Y})";
}
Expression-bodied properties
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist => Sqrt(X * X + Y * Y);
public override string ToString() => "({X}, {Y})";
}
Expression-bodied properties
using System.Math;
public class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) { X = x; Y = y; }
public double Dist => Sqrt(X * X + Y * Y);
public override string ToString() => "({X}, {Y})";
}
Index initializers
public class Point
{
public int X { get; }
public int Y { get; }
…
public JObject ToJson()
{
var result = new JObject();
result["x"] = X;
result["y"] = Y;
return result;
}
}
Index initializers
public class Point
{
public int X { get; }
public int Y { get; }
…
public JObject ToJson()
{
var result = new JObject() { ["x"] = X, ["y"] = Y };
return result;
}
}
Index initializers
public class Point
{
public int X { get; }
public int Y { get; }
…
public JObject ToJson()
{
return new JObject() { ["x"] = X, ["y"] = Y };
}
}
Index initializers
public class Point
{
public int X { get; }
public int Y { get; }
…
public JObject ToJson() =>
new JObject() { ["x"] = X, ["y"] = Y };
}
Null-conditional operators
public static Point FromJson(JObject json)
{
if (json != null &&
json["x"] != null &&
json["x"].Type == JTokenType.Integer &&
json["y"] != null &&
json["y"].Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int)json["y"]);
}
return null;
}
Null-conditional operators
public static Point FromJson(JObject json)
{
if (json != null &&
json["x"]?.Type == JTokenType.Integer &&
json["y"]?.Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int)json["y"]);
}
return null;
}
Null-conditional operators
public static Point FromJson(JObject json)
{
if (json != null &&
json["x"]?.Type == JTokenType.Integer &&
json["y"]?.Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int)json["y"]);
}
return null;
}
?.
Null-conditional operators
public static Point FromJson(JObject json)
{
if (json != null &&
json["x"]?.Type == JTokenType.Integer &&
json["y"]?.Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int)json["y"]);
}
return null;
}
Null-conditional operators
public static Point FromJson(JObject json)
{
if (json?["x"]?.Type == JTokenType.Integer &&
json?["y"]?.Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int)json["y"]);
}
return null;
}
Null-conditional operators
OnChanged(this, args);
Null-conditional operators
if (OnChanged != null)
{
OnChanged(this, args);
}
Null-conditional operators
{
var onChanged = OnChanged;
if (onChanged != null)
{
onChanged(this, args);
}
}
Null-conditional operators
OnChanged?.Invoke(this, args);
The nameof operator
public Point Add(Point point)
{
if (point == null)
{
throw new ArgumentNullException("point");
}
}
The nameof operator
public Point Add(Point other)
{
if (other == null)
{
throw new ArgumentNullException("point");
}
}
The nameof operator
public Point Add(Point point)
{
if (point == null)
{
throw new ArgumentNullException(nameof(point));
}
}
The nameof operator
public Point Add(Point other)
{
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
}
Exception filters
try
{
…
}
catch (ConfigurationException e)
{
}
finally
{
}
Exception filters
try
{
…
}
catch (ConfigurationException e) if (e.IsSevere)
{
}
finally
{
}
Await in catch and finally
try
{
…
}
catch (ConfigurationException e) if (e.IsSevere)
{
await LogAsync(e);
}
finally
{
await CloseAsync();
}
roslyn.codeplex.com
Learn more at …
© 2015 Microsoft Corporation. All rights reserved.
tech days•
2015
#mstechdays techdays.microsoft.fr

More Related Content

What's hot

Kotlin, why?
Kotlin, why?Kotlin, why?
Kotlin, why?
Paweł Byszewski
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
Khirulnizam Abd Rahman
 
The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 33 of 184
The Ring programming language version 1.5.3 book - Part 33 of 184The Ring programming language version 1.5.3 book - Part 33 of 184
The Ring programming language version 1.5.3 book - Part 33 of 184
Mahmoud Samir Fayed
 
OOP v3
OOP v3OOP v3
OOP v3
Sunil OS
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189
Mahmoud Samir Fayed
 
Object calisthenics
Object calisthenicsObject calisthenics
Object calisthenics
PolSnchezManzano
 
Java Puzzle
Java PuzzleJava Puzzle
Java PuzzleSFilipp
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
ADITYA BHARTI
 
Scala best practices
Scala best practicesScala best practices
Scala best practices
Alexander Zaidel
 
The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184
Mahmoud Samir Fayed
 
18. Java associative arrays
18. Java associative arrays18. Java associative arrays
18. Java associative arrays
Intro C# Book
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
Aleksandar Veselinovic
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196
Mahmoud Samir Fayed
 
Haskell 101
Haskell 101Haskell 101
Haskell 101
Roberto Pepato
 

What's hot (20)

Kotlin, why?
Kotlin, why?Kotlin, why?
Kotlin, why?
 
Chapter 4 - Classes in Java
Chapter 4 - Classes in JavaChapter 4 - Classes in Java
Chapter 4 - Classes in Java
 
The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181The Ring programming language version 1.5.2 book - Part 32 of 181
The Ring programming language version 1.5.2 book - Part 32 of 181
 
The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88
 
The Ring programming language version 1.5.3 book - Part 33 of 184
The Ring programming language version 1.5.3 book - Part 33 of 184The Ring programming language version 1.5.3 book - Part 33 of 184
The Ring programming language version 1.5.3 book - Part 33 of 184
 
OOP v3
OOP v3OOP v3
OOP v3
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180
 
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189
 
Object calisthenics
Object calisthenicsObject calisthenics
Object calisthenics
 
Java Puzzle
Java PuzzleJava Puzzle
Java Puzzle
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
 
Scala best practices
Scala best practicesScala best practices
Scala best practices
 
The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202
 
The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184
 
18. Java associative arrays
18. Java associative arrays18. Java associative arrays
18. Java associative arrays
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
Array
ArrayArray
Array
 
The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196The Ring programming language version 1.7 book - Part 34 of 196
The Ring programming language version 1.7 book - Part 34 of 196
 
Haskell 101
Haskell 101Haskell 101
Haskell 101
 

Viewers also liked

De A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
De A à Z: Accès aux données avec Entity Framework 4.2 et publication en ODataDe A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
De A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
Microsoft
 
Keynote développement mobile : les solutions pour Windows (Phone), Android et...
Keynote développement mobile : les solutions pour Windows (Phone), Android et...Keynote développement mobile : les solutions pour Windows (Phone), Android et...
Keynote développement mobile : les solutions pour Windows (Phone), Android et...
Microsoft
 
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
Microsoft
 
Découverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet SpartanDécouverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet Spartan
Microsoft
 
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
Microsoft
 
Solutions et méthodes pour accélérer le déploiement de Lync
Solutions  et méthodes pour accélérer le déploiement de LyncSolutions  et méthodes pour accélérer le déploiement de Lync
Solutions et méthodes pour accélérer le déploiement de Lync
Microsoft
 
Python dans le cloud avec Windows Azure
Python dans le cloud avec Windows AzurePython dans le cloud avec Windows Azure
Python dans le cloud avec Windows Azure
Microsoft
 

Viewers also liked (7)

De A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
De A à Z: Accès aux données avec Entity Framework 4.2 et publication en ODataDe A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
De A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData
 
Keynote développement mobile : les solutions pour Windows (Phone), Android et...
Keynote développement mobile : les solutions pour Windows (Phone), Android et...Keynote développement mobile : les solutions pour Windows (Phone), Android et...
Keynote développement mobile : les solutions pour Windows (Phone), Android et...
 
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
365 raisons d’inclure Office365 dans vos apps mobiles (Authentifications, Lis...
 
Découverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet SpartanDécouverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet Spartan
 
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
Faites comme Netflix, voire mieux : diffuser de la VOD et du Live dans le mon...
 
Solutions et méthodes pour accélérer le déploiement de Lync
Solutions  et méthodes pour accélérer le déploiement de LyncSolutions  et méthodes pour accélérer le déploiement de Lync
Solutions et méthodes pour accélérer le déploiement de Lync
 
Python dans le cloud avec Windows Azure
Python dans le cloud avec Windows AzurePython dans le cloud avec Windows Azure
Python dans le cloud avec Windows Azure
 

Similar to Les nouveautés de C# 6

TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
tdc-globalcode
 
New C# features
New C# featuresNew C# features
New C# features
Alexej Sommer
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewPaulo Morgado
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
662305 10
662305 10662305 10
C sharp 8
C sharp 8C sharp 8
C sharp 8
Germán Küber
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
Ganesh Samarthyam
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
intelliyole
 
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsMonadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
Chris Eargle
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Point.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdfPoint.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdf
anokhilalmobile
 
First few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examplesFirst few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examples
Nebojša Vukšić
 
[Codemotion 2015] patrones de diseño con java8
[Codemotion 2015] patrones de diseño con java8[Codemotion 2015] patrones de diseño con java8
[Codemotion 2015] patrones de diseño con java8
Alonso Torres
 
Operator overloading (binary)
Operator overloading (binary)Operator overloading (binary)
Operator overloading (binary)
Ramish Suleman
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogramming
Mårten Rånge
 
Functional Programming with C#
Functional Programming with C#Functional Programming with C#
Functional Programming with C#
EastBanc Tachnologies
 
Parameters
ParametersParameters
Parameters
James Brotsos
 

Similar to Les nouveautés de C# 6 (20)

TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
 
New C# features
New C# featuresNew C# features
New C# features
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
 
662305 10
662305 10662305 10
662305 10
 
C sharp 8
C sharp 8C sharp 8
C sharp 8
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Comp102 lec 7
Comp102   lec 7Comp102   lec 7
Comp102 lec 7
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
 
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query ExpressionsMonadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Point.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdfPoint.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdf
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
First few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examplesFirst few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examples
 
[Codemotion 2015] patrones de diseño con java8
[Codemotion 2015] patrones de diseño con java8[Codemotion 2015] patrones de diseño con java8
[Codemotion 2015] patrones de diseño con java8
 
Operator overloading (binary)
Operator overloading (binary)Operator overloading (binary)
Operator overloading (binary)
 
An introduction to scala
An introduction to scalaAn introduction to scala
An introduction to scala
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogramming
 
Functional Programming with C#
Functional Programming with C#Functional Programming with C#
Functional Programming with C#
 
Parameters
ParametersParameters
Parameters
 

More from Microsoft

Uwp + Xamarin : Du nouveau en terre du milieu
Uwp + Xamarin : Du nouveau en terre du milieuUwp + Xamarin : Du nouveau en terre du milieu
Uwp + Xamarin : Du nouveau en terre du milieu
Microsoft
 
La Blockchain pas à PaaS
La Blockchain pas à PaaSLa Blockchain pas à PaaS
La Blockchain pas à PaaS
Microsoft
 
Tester, Monitorer et Déployer son application mobile
Tester, Monitorer et Déployer son application mobileTester, Monitorer et Déployer son application mobile
Tester, Monitorer et Déployer son application mobile
Microsoft
 
Windows 10, un an après – Nouveautés & Démo
Windows 10, un an après – Nouveautés & Démo Windows 10, un an après – Nouveautés & Démo
Windows 10, un an après – Nouveautés & Démo
Microsoft
 
Prenez votre pied avec les bots et cognitive services.
Prenez votre pied avec les bots et cognitive services.Prenez votre pied avec les bots et cognitive services.
Prenez votre pied avec les bots et cognitive services.
Microsoft
 
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
Microsoft
 
Créer un bot de A à Z
Créer un bot de A à ZCréer un bot de A à Z
Créer un bot de A à Z
Microsoft
 
Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?
Microsoft
 
Les nouveautés SQL Server 2016
Les nouveautés SQL Server 2016Les nouveautés SQL Server 2016
Les nouveautés SQL Server 2016
Microsoft
 
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
Microsoft
 
Administration et supervision depuis le Cloud avec Azure Logs Analytics
Administration et supervision depuis le Cloud avec Azure Logs AnalyticsAdministration et supervision depuis le Cloud avec Azure Logs Analytics
Administration et supervision depuis le Cloud avec Azure Logs Analytics
Microsoft
 
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
Microsoft
 
Plan de Reprise d'Activité avec Azure Site Recovery
Plan de Reprise d'Activité avec Azure Site RecoveryPlan de Reprise d'Activité avec Azure Site Recovery
Plan de Reprise d'Activité avec Azure Site Recovery
Microsoft
 
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
Microsoft
 
Transformation de la représentation : De la VR à la RA, aller & retour.
Transformation de la représentation : De la VR à la RA, aller & retour.Transformation de la représentation : De la VR à la RA, aller & retour.
Transformation de la représentation : De la VR à la RA, aller & retour.
Microsoft
 
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
Microsoft
 
Introduction à ASP.NET Core
Introduction à ASP.NET CoreIntroduction à ASP.NET Core
Introduction à ASP.NET Core
Microsoft
 
Open Source et Microsoft Azure, rêve ou réalité ?
Open Source et Microsoft Azure, rêve ou réalité ?Open Source et Microsoft Azure, rêve ou réalité ?
Open Source et Microsoft Azure, rêve ou réalité ?
Microsoft
 
Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...
Microsoft
 
Azure Service Fabric pour les développeurs
Azure Service Fabric pour les développeursAzure Service Fabric pour les développeurs
Azure Service Fabric pour les développeurs
Microsoft
 

More from Microsoft (20)

Uwp + Xamarin : Du nouveau en terre du milieu
Uwp + Xamarin : Du nouveau en terre du milieuUwp + Xamarin : Du nouveau en terre du milieu
Uwp + Xamarin : Du nouveau en terre du milieu
 
La Blockchain pas à PaaS
La Blockchain pas à PaaSLa Blockchain pas à PaaS
La Blockchain pas à PaaS
 
Tester, Monitorer et Déployer son application mobile
Tester, Monitorer et Déployer son application mobileTester, Monitorer et Déployer son application mobile
Tester, Monitorer et Déployer son application mobile
 
Windows 10, un an après – Nouveautés & Démo
Windows 10, un an après – Nouveautés & Démo Windows 10, un an après – Nouveautés & Démo
Windows 10, un an après – Nouveautés & Démo
 
Prenez votre pied avec les bots et cognitive services.
Prenez votre pied avec les bots et cognitive services.Prenez votre pied avec les bots et cognitive services.
Prenez votre pied avec les bots et cognitive services.
 
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
Office 365 Dev PnP & PowerShell : exploitez enfin le potentiel de votre écosy...
 
Créer un bot de A à Z
Créer un bot de A à ZCréer un bot de A à Z
Créer un bot de A à Z
 
Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?
 
Les nouveautés SQL Server 2016
Les nouveautés SQL Server 2016Les nouveautés SQL Server 2016
Les nouveautés SQL Server 2016
 
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
Conteneurs Linux ou Windows : quelles approches pour des IT agiles ?
 
Administration et supervision depuis le Cloud avec Azure Logs Analytics
Administration et supervision depuis le Cloud avec Azure Logs AnalyticsAdministration et supervision depuis le Cloud avec Azure Logs Analytics
Administration et supervision depuis le Cloud avec Azure Logs Analytics
 
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
Retour d'expérience de projets Azure IoT "large scale" (MicroServices, portag...
 
Plan de Reprise d'Activité avec Azure Site Recovery
Plan de Reprise d'Activité avec Azure Site RecoveryPlan de Reprise d'Activité avec Azure Site Recovery
Plan de Reprise d'Activité avec Azure Site Recovery
 
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
Modélisation, déploiement et gestion des infrastructures Cloud : outils et bo...
 
Transformation de la représentation : De la VR à la RA, aller & retour.
Transformation de la représentation : De la VR à la RA, aller & retour.Transformation de la représentation : De la VR à la RA, aller & retour.
Transformation de la représentation : De la VR à la RA, aller & retour.
 
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
Quelles architectures pour vos applications Cloud, de la VM au conteneur : ça...
 
Introduction à ASP.NET Core
Introduction à ASP.NET CoreIntroduction à ASP.NET Core
Introduction à ASP.NET Core
 
Open Source et Microsoft Azure, rêve ou réalité ?
Open Source et Microsoft Azure, rêve ou réalité ?Open Source et Microsoft Azure, rêve ou réalité ?
Open Source et Microsoft Azure, rêve ou réalité ?
 
Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...
 
Azure Service Fabric pour les développeurs
Azure Service Fabric pour les développeursAzure Service Fabric pour les développeurs
Azure Service Fabric pour les développeurs
 

Recently uploaded

Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Les nouveautés de C# 6

  • 2. Agenda • Introduction: evolution of C# • C# 6.0 • Getter-only auto-properties • Initializers for auto-properties • Using static classes • String interpolation • Expression-bodied methods • Expression-bodied properties • Index initializers • Null-conditional operator • Nameof operator • Exception filter • Q&A
  • 3. The Evolution of C# C# 1.0 C# 2.0 C# 3.0 Managed Code Generics Language Integrated Query C# 4.0 Dynamic Programming C# 5.0 Asynchrony (await)
  • 4. .Net Compiler Platform: Roslyn •INTRODUCTION •EXPOSING THE COMPILER APIS • COMPILER PIPELINE FUNCTIONAL AREAS • API LAYERS • Compiler APIs • Workspaces APIs •WORKING WITH SYNTAX • SYNTAX TREES • SYNTAX NODES • SYNTAX TOKENS • SYNTAX TRIVIA • SPANS • KINDS • ERRORS •WORKING WITH SEMANTICS • COMPILATION • SYMBOLS • SEMANTIC MODEL •WORKING WITH A WORKSPACE • WORKSPACE • SOLUTIONS, PROJECTS, DOCUMENTS •SUMMARY
  • 5. Getter-only auto-properties public class Point { public int X { get; set; } public int Y { get; set; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 6. Getter-only auto-properties public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 7. Getter-only auto-properties public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 8. Initializers for auto-properties public class Point { public int X { get; } = 5; public int Y { get; } = 7; public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 9. Using static classes using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 10. Using static classes using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Math.Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 11. Using static classes using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 12. String interpolation using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() { return String.Format("({0}, {1})", X, Y); } }
  • 13. String interpolation using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() { return "({X}, {Y})"; } }
  • 14. Expression-bodied methods using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() { return "({X}, {Y})"; } }
  • 15. Expression-bodied methods using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() { return "({X}, {Y})"; } } () => { return "({X}, {Y})"; } () => "({X}, {Y})"
  • 16. Expression-bodied methods using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() => "({X}, {Y})"; }
  • 17. Expression-bodied properties using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist { get { return Sqrt(X * X + Y * Y); } } public override string ToString() => "({X}, {Y})"; }
  • 18. Expression-bodied properties using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist => Sqrt(X * X + Y * Y); public override string ToString() => "({X}, {Y})"; }
  • 19. Expression-bodied properties using System.Math; public class Point { public int X { get; } public int Y { get; } public Point(int x, int y) { X = x; Y = y; } public double Dist => Sqrt(X * X + Y * Y); public override string ToString() => "({X}, {Y})"; }
  • 20. Index initializers public class Point { public int X { get; } public int Y { get; } … public JObject ToJson() { var result = new JObject(); result["x"] = X; result["y"] = Y; return result; } }
  • 21. Index initializers public class Point { public int X { get; } public int Y { get; } … public JObject ToJson() { var result = new JObject() { ["x"] = X, ["y"] = Y }; return result; } }
  • 22. Index initializers public class Point { public int X { get; } public int Y { get; } … public JObject ToJson() { return new JObject() { ["x"] = X, ["y"] = Y }; } }
  • 23. Index initializers public class Point { public int X { get; } public int Y { get; } … public JObject ToJson() => new JObject() { ["x"] = X, ["y"] = Y }; }
  • 24. Null-conditional operators public static Point FromJson(JObject json) { if (json != null && json["x"] != null && json["x"].Type == JTokenType.Integer && json["y"] != null && json["y"].Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } return null; }
  • 25. Null-conditional operators public static Point FromJson(JObject json) { if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } return null; }
  • 26. Null-conditional operators public static Point FromJson(JObject json) { if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } return null; } ?.
  • 27. Null-conditional operators public static Point FromJson(JObject json) { if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } return null; }
  • 28. Null-conditional operators public static Point FromJson(JObject json) { if (json?["x"]?.Type == JTokenType.Integer && json?["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } return null; }
  • 30. Null-conditional operators if (OnChanged != null) { OnChanged(this, args); }
  • 31. Null-conditional operators { var onChanged = OnChanged; if (onChanged != null) { onChanged(this, args); } }
  • 33. The nameof operator public Point Add(Point point) { if (point == null) { throw new ArgumentNullException("point"); } }
  • 34. The nameof operator public Point Add(Point other) { if (other == null) { throw new ArgumentNullException("point"); } }
  • 35. The nameof operator public Point Add(Point point) { if (point == null) { throw new ArgumentNullException(nameof(point)); } }
  • 36. The nameof operator public Point Add(Point other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } }
  • 39. Await in catch and finally try { … } catch (ConfigurationException e) if (e.IsSevere) { await LogAsync(e); } finally { await CloseAsync(); }
  • 41. © 2015 Microsoft Corporation. All rights reserved. tech days• 2015 #mstechdays techdays.microsoft.fr