I have just installed Visual Studio 2015 and was playing with C# 6.0.
It has loads of new features supported out of the box that are mainly for making the code clean and lean.
Some of the features supported by C# 6.0 are already listed in the following link: What is new in C# 6.0.
I tried to run a sample application that uses some of the new features and found it very interesting.
Null checks using the conditional operator (? :) (unofficially called the Elvis operator) and String.Format using \{} (also called string interpolation) and loads of such things are supported by the Framework out of the box.
Here is a sample code that can get you started:
- using System.Console;
- namespace VS2015Sample
- {
- class Program
- {
- static void Main(string[] args)
- {
- string version = ".Net 4.6";
- object vsEditor = null;
- WriteLine("Sample executing with VS 2015 on \{version} \{vsEditor?.ToString()}");
- vsEditor = "VS 2015";
- WriteLine("Sample executing with VS 2015 on \{version} \{vsEditor?.ToString()}");
- ReadLine();
- }
- }
- }

If you see in the code above, I am not using Console.WriteLine or Console.ReadLine anywhere. I am also not having null checks for displaying the vsEditor details. Also, String.Format is not used anywhere for formatting display strings.
The output of the code above will be as depicted below:

C# 6.0 looks promising and will help the developer fraternity with many simple tricks.
Happy coding!

Former memberPosted Nov 18, 2014, 4:00 AM
all good ! actually i was trying primary constructor. Later read that its no longer supported in c# 6.0 :) thanks for nice article !
Abhishek BhatPosted Nov 18, 2014, 3:37 AM
Dhananjay sir...what error are you getting? I just installed VS.Net 2015 and got started with Console application.
Arif AnsariPosted Nov 18, 2014, 1:46 AM
thanks Abhishek sir.....
Former memberPosted Nov 18, 2014, 12:16 AM
do you done anything extra to run c# 6.0 feature on VS 2015 ? I am trying but getting build error !!
Vithal WadjePosted Nov 17, 2014, 9:57 PM
yes really good features
Abhishek BhatPosted Nov 17, 2014, 11:39 AM
Thanks Dinesh.
Dinesh BeniwalPosted Nov 17, 2014, 7:01 AM
Thanks Abhishek for sharing, expecting some more articles on C# 6.0 from you.