introduction to c# 6.0 and 7.0
TRANSCRIPT
C# 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
Agenda• Overview C# 6.0• Tuples & Deconstruction of Tuples • Out variables• Pattern matching • Local functions• Literal improvements• 'return' by Ref• Throw expressions • Q&A
Static Types as using
Overview C# 6.0
String Interpolation
Dictionary Initializers
Auto-Property Initializers
nameof expression
Expression Bodied Function & Property
C# 7.0
Tuples (with types and literals)
Minimizing OUT
Local FunctionsLocal functions would have the same capabilities as normal methods but would only be scoped to the block they were declared in.
Readability Improvement with Literals
Is-expressions with patterns
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
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.
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:
Thank You
Q&A• Connect with me• Csharpcorner: /saineshwar bageri• Facebook: fb.com/saineshwar.bageri• Twitter: @saihacksoft