Annnd .. you'll love it.
Version 6.0 has been out since April via the new .NET compiler, Roslyn and will soon ship with Visual Studio 14 but To help you find its awesomeness here are a few highlights.
Null Propergation operator
Probably this was the feature you were waiting for all along The Null propergation operator ( ?. ). lets assume you have an object (Employee) which holds a property which is another class object (Department) which in turn holds a string property (Name) and your objective is to assign a value to this string property imagine how ugly this code looks
Before :
This looks ugly. so many conditional checks to make sure we do not face the null object exception.
With C# 6.0 you do it in this awesome way.
Now:
No "if" conditions for null checks anymore and you can assign the value , All you have to do is use the Null Propergation operator (?.) on the object to find out if its not null and assign the value.
How cool is that ?! This is not limited to properties only, this works even on methods.
Now:
Thinking of disposing an object..?
Now:
Employee object wont be disposed if its null and if its not null, gone into the garbage can!
Auto Property Initializer and Primary Constructors
Remember we could assign(initialize) a value to a variable as and when we declare it but we could not do the same for the property declaration? well that is a thing of the past now and would it not be nice if you could declare the default constructor in a simpler way? well there is a way now for that as well.
Before:
Now:
Please note: C# is making us LAZY!!
Exception Filtering now made easy
Imagine you have no clue what type of exception you are going to come across and you will write a generic catch block. But however you have to run some specific statements based on the error code?
well you would do it the following way
Before:
well now if can filter this as below.
Now:
looks cleaner doesnt it?
Declaring the variables inline
Now we can declare variables inline and can still be used outside. how? refer below.
Before:
Now:
All this and more in the C# v 6.0 .
Do note that with the Roslyn compiler you can still get all the above and more benefits in your existing projects.
There is a lot more .. please visit http://msdn.microsoft.com/en-us/magazine/dn683793.aspx
For the FAQs on Roslyn please follow http://blogs.msdn.com/b/csharpfaq/archive/2014/04/03/taking-a-tour-of-roslyn.aspx
Version 6.0 has been out since April via the new .NET compiler, Roslyn and will soon ship with Visual Studio 14 but To help you find its awesomeness here are a few highlights.
Null Propergation operator
Probably this was the feature you were waiting for all along The Null propergation operator ( ?. ). lets assume you have an object (Employee) which holds a property which is another class object (Department) which in turn holds a string property (Name) and your objective is to assign a value to this string property imagine how ugly this code looks
Before :
This looks ugly. so many conditional checks to make sure we do not face the null object exception.
With C# 6.0 you do it in this awesome way.
Now:
No "if" conditions for null checks anymore and you can assign the value , All you have to do is use the Null Propergation operator (?.) on the object to find out if its not null and assign the value.
How cool is that ?! This is not limited to properties only, this works even on methods.
Now:
Thinking of disposing an object..?
Now:
Employee object wont be disposed if its null and if its not null, gone into the garbage can!
Auto Property Initializer and Primary Constructors
Remember we could assign(initialize) a value to a variable as and when we declare it but we could not do the same for the property declaration? well that is a thing of the past now and would it not be nice if you could declare the default constructor in a simpler way? well there is a way now for that as well.
Before:
Now:
Please note: C# is making us LAZY!!
Exception Filtering now made easy
Imagine you have no clue what type of exception you are going to come across and you will write a generic catch block. But however you have to run some specific statements based on the error code?
well you would do it the following way
Before:
well now if can filter this as below.
Now:
looks cleaner doesnt it?
Declaring the variables inline
Now we can declare variables inline and can still be used outside. how? refer below.
Before:
Now:
All this and more in the C# v 6.0 .
Do note that with the Roslyn compiler you can still get all the above and more benefits in your existing projects.
There is a lot more .. please visit http://msdn.microsoft.com/en-us/magazine/dn683793.aspx
For the FAQs on Roslyn please follow http://blogs.msdn.com/b/csharpfaq/archive/2014/04/03/taking-a-tour-of-roslyn.aspx
Legend Online Benzeri Oyunlar
ReplyDeleteMafia 2 Benzeri Oyunlar
Simcity Benzeri Oyunlar
Papers Please Benzeri Oyunlar
Phasmophobia Benzeri Oyunlar
DSBTS
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
UHXW
ayvalık transfer
ReplyDeleteçeşme transfer
urla transfer
akbük transfer
davutlar transfer
XQTKV4
مكافحة حشرات 5qH3t4VmO9
ReplyDeleteشركه مكافحه حشرات بالاحساء u9eaupLU2I
ReplyDeleteنفخ المجاري بالاحساء Cy4hvsqqa8
ReplyDelete