You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
In this article, you will learn the top 10 and the most popular new features of C# 7 with Visual Studio 2017 RC.
Most of you are already aware that Visual Studio 2017 RC has been released and it comes with a lot of new features. In this article, I am going to discuss only about C# 7 features. The other features will be explained in my upcoming articles.
In C# 7, a lot of new features have been introduced, and also enhancement have been done for some features. I will be covering all those things in context of Visual Studio 2017 RC. Given below is the list of features which I am going to explain in this article.
In the above list, I have mentioned only 10 new features of C# 7 but there are some more features like Generalized async (Generalized async return), Replace (Partial Class Enhancements) Records (or Record Types) Non-Nullable Reference Types, Immutable Types etc. Some of the features are not yet supported in Visual Studio 2017 RC and are still under development. Even C# 7 has not been developed completely and still it is in preview mode. You can ignore some of the features of C# 7 right now and focus on the features which can be tested in Visual Studio 2017 RC. Below is a pictorial representation of the major features of C# 7 which are supported in Visual Studio 2017 RC.
Now, re-build your solution. You will notice that error has been removed and your application is built successfully.Now, you may be thinking how to utilize or call this tuple method. It’s very simple. Just have a look at the below code snippet.
C# 6.0Expression bodied MethodsExpression bodied PropertiesC# 7.0Expression bodied constructorExpression bodied destructorExpression bodied gettersExpression bodied settersExpression Bodied MethodsIn C# 6, Microsoft introduced a new feature Expression-bodied Methods which was very similar to and inspired by anonymous & lambda expression. But there are some differences between these two.In the case of Expression-bodied methods, it must have a return type, name, and returned expression.We can use access modifiers (private, public, protected, internal and protected internal) with expression-bodied method. We can declare it as virtual, static, or it can also override its parent class method. It can be asynchronous if it is returning void.Example 1Expression bodied method has access modifier as public and return type string.Code Snippet
Pro WPF: Windows Presentation Foundation in .NET 3.0