introduction to c# 6.0 and 7.0

22
C# 7.0

Upload: saineshwar-bageri

Post on 05-Apr-2017

128 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Introduction to C# 6.0 and 7.0

C# 7.0

Page 2: Introduction to C# 6.0 and 7.0

Csharpcorner: saineshwar-bageri

Twitter: @saihacksoft

Facebook: fb.com/saineshwar.bageri

Who am I?

Saineshwar BageriSoftware EngineerCsharpcorner 3 Times MVPAuthor & SpeakerCommunity contributor on Csharpcorner Code project & Stack overflow, Tutlane ,Github

Page 3: Introduction to C# 6.0 and 7.0

Agenda• Overview C# 6.0• Tuples & Deconstruction of Tuples • Out variables• Pattern matching • Local functions• Literal improvements• 'return' by Ref• Throw expressions • Q&A

Page 4: Introduction to C# 6.0 and 7.0
Page 5: Introduction to C# 6.0 and 7.0

Static Types as using

Page 6: Introduction to C# 6.0 and 7.0

Overview C# 6.0

Page 7: Introduction to C# 6.0 and 7.0

String Interpolation

Page 8: Introduction to C# 6.0 and 7.0

Dictionary Initializers

Page 9: Introduction to C# 6.0 and 7.0

Auto-Property Initializers

Page 10: Introduction to C# 6.0 and 7.0

nameof expression

Page 11: Introduction to C# 6.0 and 7.0

Expression Bodied Function & Property

Page 12: Introduction to C# 6.0 and 7.0

C# 7.0

Page 13: Introduction to C# 6.0 and 7.0

Tuples (with types and literals)

Page 14: Introduction to C# 6.0 and 7.0

Minimizing OUT

Page 15: Introduction to C# 6.0 and 7.0

Local FunctionsLocal functions would have the same capabilities as normal methods but would only be scoped to the block they were declared in.

Page 16: Introduction to C# 6.0 and 7.0

Readability Improvement with Literals

Page 17: Introduction to C# 6.0 and 7.0

Is-expressions with patterns

Page 18: Introduction to C# 6.0 and 7.0

Switch statements with patterns

• You can switch on any type (not just primitive types)• Patterns can be used in case clauses• Case clauses can have additional conditions on them

Page 19: Introduction to C# 6.0 and 7.0

Ref returnsHave you tried to return your variable from method/function as Ref ? Yes, C# 7.0 allows you to do that. Infect you can pass a variable with Ref return them as Ref  and also store them as Ref, isn't it amazing.

Page 20: Introduction to C# 6.0 and 7.0

Throw expressionsIt is easy to throw an exception in the middle of an expression: just call a method that does it for you! But in C# 7.0 we are directly allowing throw as an expression in certain places:

Page 21: Introduction to C# 6.0 and 7.0

Thank You

Page 22: Introduction to C# 6.0 and 7.0

Q&A• Connect with me• Csharpcorner: /saineshwar bageri• Facebook: fb.com/saineshwar.bageri• Twitter: @saihacksoft