SlideShare une entreprise Scribd logo
1  sur  19
MAXIME LEMAITRE – 26/11/2015
C# 6
… meet roslyn …
Agenda
• New features
• Bonus
• Demo
• Conclusion
• Question Released July 20, 2015 with
.net 4.6, Roslyn, VS 2015
Auto-Property Initializers
You can initialize an auto-implemented
property inline. You no longer have to
declare a setter, providing a new way to
implement an immutable property
auto-implemented
properties were
introduced in C# 3.0.
Read-Only Auto-Properties
You no longer have to declare a setter for auto-implemented
properties. If no setter is declared, the property is immutable
everywhere except the type’s constructor
Null-Conditional Operator
If student is null, address will simply be
assigned null, and no NullReferenceExeception
will occur. This becomes more useful with
deeper object graphs.
Using Static Directives
Using static directives are a new kind of using directive which
brings static members of types directly into scope.
The intention of this feature is to improve code readability by
eliminating unnecessary and/or redundant type identifiers
String Interpolation
typically to concatenate strings you would either use
the “+” operator or composite formatting with a method
such as String.Format
With interpolated string expressions, you have a
string with contained expressions that are
replaced with the expressions’ results. You have to
prefix your string literal with a dollar sign ($)
nameof Expressions
Now with nameof expressions, you don’t have
to use string literals and the compiler will be
able to warn you if you are using an incorrect
name.
Some examples of where nameof expressions may be useful include:
• Throwing exceptions during parameter validation
• Passing an action name when setting up MVC action links
• Needing to pass the name of a property when firing a property changed event in
a class that implements INotifyPropertyChanged
• Passing the name of a property when registering a XAML dependency property
• Including a variable, type, or member name when logging
Dictionary Initializers
slightly cleaner syntax for
dictionary initialization
Expression Bodied Functions and Properties
You can now declare functions and properties as a lambda
expression, without the need for a statement block. Intended
for simple implementations, the new syntax is more concise in
that it eliminates the need for some of the curly braces and the
use of an explicit return statement.
Await in Catch and Finally Blocks
Ability to write asynchronous code
(use the await keyword) in catch and
finally blocks
Exception Filters
Now, through the use of the “when” keyword, we can
specify a condition for any catch block. Execution will
only drop into a catch block if the condition is satisfied.
This allows us to filter exceptions on things other than
just the exception type.
Conclusion
C# 6.0 isn’t a radical revolution in C# programming.
This version will change the way you write C# code
in specific scenarios. But Roslyn add new
possibilities in C# 7 is on track…
Bonus : Live code analysis (light bulbs)
The new Roslyn compiler for C# and Visual Basic not only provides faster compile
times—it also enables completely new scenarios such as live code analysis, which
provide rich and customizable feedback and suggestions directly inside the code
editor as you type
Demo
Questions
References
• https://medium.com/@JoeIngeno/c-6-0-features-you-should-know-f8d9056f3330
• https://msdn.microsoft.com/en-us/magazine/dn802602.aspx
• https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6
• https://github.com/dotnet/roslyn/issues/2136 (C# 7 work list of features)
• http://stackoverflow.com/questions/27093908/how-to-enable-c-sharp-6-0-feature-in-visual-studio-2013
• https://github.com/dotnet/roslyn
• https://www.nuget.org/packages/Microsoft.Net.Compilers/ (standalone compiler via nuget)
About Us
• Betclic Everest Group, one of the world leaders in online
gaming, has a unique portfolio comprising various
complementary international brands: Betclic, Everest
Poker/Casino, Bet-at-home, Expekt, Imperial Casino, Monte-
Carlo Casino…
• Through our brands, Betclic Everest Group places expertise,
technological know-how and security at the heart of our
strategy to deliver an on-line gaming offer attuned to the
passion of our players. We want our brands to be easy to use
for every gamer around the world. We’re building our
company to make that happen.
• Active in 100 countries with more than 12 million customers
worldwide, the Group is committed to promoting secure and
responsible gaming and is a member of several international
professional associations including the EGBA (European
Gaming and Betting Association) and the ESSA (European
Sports Security Association).
We want our Sports betting, Poker, Horse racing and
Casino & Games brands to be easy to use for every
gamer around the world. Code with us to make that
happen.
Look at all the challenges we offer HERE
Check our Employer Page
Follow us on LinkedIn
WE’RE HIRING !

Contenu connexe

Plus de Betclic Everest Group Tech Team

Plus de Betclic Everest Group Tech Team (20)

Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
 
Lean for Business
Lean for BusinessLean for Business
Lean for Business
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Mini-Training: Roslyn
Mini-Training: RoslynMini-Training: Roslyn
Mini-Training: Roslyn
 
Mini-Training: Netflix Simian Army
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
 
WCF Configuration - The basics
WCF Configuration - The basicsWCF Configuration - The basics
WCF Configuration - The basics
 
Mini-Training: Javascript Patterns
Mini-Training: Javascript PatternsMini-Training: Javascript Patterns
Mini-Training: Javascript Patterns
 
The Ten Commandments of Egoless Programming
The Ten Commandments of Egoless ProgrammingThe Ten Commandments of Egoless Programming
The Ten Commandments of Egoless Programming
 
Mini-Training: Redis
Mini-Training: RedisMini-Training: Redis
Mini-Training: Redis
 
Productivity Tips for the Busy Tech Professional
Productivity Tips for the Busy Tech ProfessionalProductivity Tips for the Busy Tech Professional
Productivity Tips for the Busy Tech Professional
 

Dernier

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Mini training - C# 6

  • 1. MAXIME LEMAITRE – 26/11/2015 C# 6 … meet roslyn …
  • 2. Agenda • New features • Bonus • Demo • Conclusion • Question Released July 20, 2015 with .net 4.6, Roslyn, VS 2015
  • 3. Auto-Property Initializers You can initialize an auto-implemented property inline. You no longer have to declare a setter, providing a new way to implement an immutable property auto-implemented properties were introduced in C# 3.0.
  • 4. Read-Only Auto-Properties You no longer have to declare a setter for auto-implemented properties. If no setter is declared, the property is immutable everywhere except the type’s constructor
  • 5. Null-Conditional Operator If student is null, address will simply be assigned null, and no NullReferenceExeception will occur. This becomes more useful with deeper object graphs.
  • 6. Using Static Directives Using static directives are a new kind of using directive which brings static members of types directly into scope. The intention of this feature is to improve code readability by eliminating unnecessary and/or redundant type identifiers
  • 7. String Interpolation typically to concatenate strings you would either use the “+” operator or composite formatting with a method such as String.Format With interpolated string expressions, you have a string with contained expressions that are replaced with the expressions’ results. You have to prefix your string literal with a dollar sign ($)
  • 8. nameof Expressions Now with nameof expressions, you don’t have to use string literals and the compiler will be able to warn you if you are using an incorrect name. Some examples of where nameof expressions may be useful include: • Throwing exceptions during parameter validation • Passing an action name when setting up MVC action links • Needing to pass the name of a property when firing a property changed event in a class that implements INotifyPropertyChanged • Passing the name of a property when registering a XAML dependency property • Including a variable, type, or member name when logging
  • 9. Dictionary Initializers slightly cleaner syntax for dictionary initialization
  • 10. Expression Bodied Functions and Properties You can now declare functions and properties as a lambda expression, without the need for a statement block. Intended for simple implementations, the new syntax is more concise in that it eliminates the need for some of the curly braces and the use of an explicit return statement.
  • 11. Await in Catch and Finally Blocks Ability to write asynchronous code (use the await keyword) in catch and finally blocks
  • 12. Exception Filters Now, through the use of the “when” keyword, we can specify a condition for any catch block. Execution will only drop into a catch block if the condition is satisfied. This allows us to filter exceptions on things other than just the exception type.
  • 13. Conclusion C# 6.0 isn’t a radical revolution in C# programming. This version will change the way you write C# code in specific scenarios. But Roslyn add new possibilities in C# 7 is on track…
  • 14. Bonus : Live code analysis (light bulbs) The new Roslyn compiler for C# and Visual Basic not only provides faster compile times—it also enables completely new scenarios such as live code analysis, which provide rich and customizable feedback and suggestions directly inside the code editor as you type
  • 15. Demo
  • 17. References • https://medium.com/@JoeIngeno/c-6-0-features-you-should-know-f8d9056f3330 • https://msdn.microsoft.com/en-us/magazine/dn802602.aspx • https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6 • https://github.com/dotnet/roslyn/issues/2136 (C# 7 work list of features) • http://stackoverflow.com/questions/27093908/how-to-enable-c-sharp-6-0-feature-in-visual-studio-2013 • https://github.com/dotnet/roslyn • https://www.nuget.org/packages/Microsoft.Net.Compilers/ (standalone compiler via nuget)
  • 18. About Us • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest Poker/Casino, Bet-at-home, Expekt, Imperial Casino, Monte- Carlo Casino… • Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players. We want our brands to be easy to use for every gamer around the world. We’re building our company to make that happen. • Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association).
  • 19. We want our Sports betting, Poker, Horse racing and Casino & Games brands to be easy to use for every gamer around the world. Code with us to make that happen. Look at all the challenges we offer HERE Check our Employer Page Follow us on LinkedIn WE’RE HIRING !