+ All Categories
Home > Software > Mini training - C# 6

Mini training - C# 6

Date post: 11-Feb-2017
Category:
Upload: betclic-everest-group-tech-team
View: 271 times
Download: 0 times
Share this document with a friend
19
MAXIME LEMAITRE – 26/11/2015 C# 6 … meet roslyn …
Transcript
Page 1: Mini training  - C# 6

MAXIME LEMAITRE – 26/11/2015

C# 6… meet roslyn …

Page 2: Mini training  - C# 6

Agenda

• New features• Bonus• Demo• Conclusion• Question Released July 20, 2015

with .net 4.6, Roslyn, VS 2015

Page 3: Mini training  - C# 6

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.

Page 4: Mini training  - C# 6

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

Page 5: Mini training  - C# 6

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.

Maxime Lemaitre
Page 6: Mini training  - C# 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

Page 7: Mini training  - C# 6

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 ($)

Page 8: Mini training  - C# 6

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

Page 9: Mini training  - C# 6

Dictionary Initializers

slightly cleaner syntax for dictionary initialization

Page 10: Mini training  - C# 6

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.

Page 11: Mini training  - C# 6

Await in Catch and Finally Blocks

Ability to write asynchronous code (use the await keyword) in catch and finally blocks

Page 12: Mini training  - C# 6

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.

Page 13: Mini training  - C# 6

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…

Page 14: Mini training  - C# 6

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

Page 15: Mini training  - C# 6

Demo

Page 16: Mini training  - C# 6

Questions

Page 18: Mini training  - C# 6

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).

Page 19: Mini training  - C# 6

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 !


Recommended