While dealing with .NET and ASP technologies, you should have a strong expertise of C#. So, I have decided to throw some light on the C# features with the release of Visual Studio 2015, in this article I am writing ten most amazing and important feature of C# which you would love to read.
It is a great feature of C#, in primary Constructor, one is allowed to pass the constructor parameters at the class declaration level instead of writing a separate constructor. It is of great use when it comes to be used with the Auto-Property initializers.
Exceptions can create a mess and they are filtered in the catch blocks with ease and cleanly with the C#. All the exceptions can be handled with the C# but a little problem is created in case of SQL Exception.
It is a big problem in many languages as well as in the old versions of other languages that you had to write a method just for one line of code. But, now in C#6 you can create an expression bodied member with only the expression and without explicit returns.
It is a very good feature in C# and the yield-keyword feature allows you to feed an innumerable of interfaces with several items. For example, you can return each power of 2 up to the exponent of 8.
With this feature in C#, which is called as Auto-property initialization feature, the developer can initialize properties without using the private set or the set of local variable.
1. Primary Constructor
It is a great feature of C#, in primary Constructor, one is allowed to pass the constructor parameters at the class declaration level instead of writing a separate constructor. It is of great use when it comes to be used with the Auto-Property initializers.
2. Exception Filters
Exceptions can create a mess and they are filtered in the catch blocks with ease and cleanly with the C#. All the exceptions can be handled with the C# but a little problem is created in case of SQL Exception.
3. Expression Bodied Method
It is a big problem in many languages as well as in the old versions of other languages that you had to write a method just for one line of code. But, now in C#6 you can create an expression bodied member with only the expression and without explicit returns.
4. Yield Keyword
It is a very good feature in C# and the yield-keyword feature allows you to feed an innumerable of interfaces with several items. For example, you can return each power of 2 up to the exponent of 8.
5. Auto-Property Initializers
With this feature in C#, which is called as Auto-property initialization feature, the developer can initialize properties without using the private set or the set of local variable.
6. Roslyn
It is one of the few best features of new C#6. Roslyn is a new compiler for C# and VB. It has a lot of improvements in it. It has a lot more features in it. It is available as a service meaning you can use the Roslyn API libraries.
7. Primary Constructor
This is also one of the best features of the language. Instead of writing a separate constructor you can use this feature to pass through the constructor parameters at the class declaration level. It can be best used with the Auto-Property initializers.
8. < Static Class> is Allowed
In any code, one thing that always disturbs is the duplication and cluttering in the code. But use of this feature is to make your code less cluttered and it will also reduce duplication.
9. Name Of The Expressions
“Name of the expressions” it might look an important feature but it really has a value. You have to sometimes refer to method arguments by its name when using automatic re-factoring tools, an example is a Reshape.
10. String Interpolation
It is also one of the important features. Now, in C#6, you can directly mention the string expressions or variables. It is an improvement to the string format functionality, here you can replace holders with string expressions or variables.
0 comments:
Post a Comment