14
Reply

Explain any three C# 6 New Features ?

Ankur Mistry

Ankur Mistry

8y
3.9k
0
Reply

    http://www.codeproject.com/Articles/327916/C-Language-Features-From-C-to

    (1) String interpolation by using symbol $ , (2) "Auto Property Initializer " which allows to initialize a property at declaration time E.g public string Country { get;} = "Country"; (3) Importing a class just like importing a namespace and consume each and every static member of the class directly in the code without a class name prefix again E.g. using static System.Console; class UsingStatic { static void Main() { WriteLine("Hello"); } }

    1)Await in catch and finally blocks 2)Initializers for auto-properties 3)nameof expressions

    https://www.simple-talk.com/dotnet/.net-framework/whats-new-in-c-6/

    For complete features of C# 6.0 please visit https://interview-preparation-for-you.blogspot.in/2017/02/c-60-features.html

    For complete features of C# 6.0 please visit https://interview-preparation-for-you.blogspot.in/2017/02/c-60-features.html

    For complete features of C# 6.0 please visit https://interview-preparation-for-you.blogspot.in/2017/02/c-60-features.html

    Static Using Syntax, Auto-Property Initializers ,Dictionary Initializers ,String Interpolation ,nameOf Expression ,Exception Filters etc,.

    Exception Filters, String Format using $, Auto Property Intializer

    1.You can create inline functions, Example: public int addNumbers(int a,int b) => a b; 2. You can declare static using, Example: using static System.Math; This would simplify the usage of Mathematical functions like Math.Pow(a,b). Instead of Math.Pow(a,b) you could use Pow(a,b) 3. It is now possible to declare the auto-properties, Example: public string FirstName { get; set; } = "Ervis";

    Please refer to below link http://www.codeproject.com/Tips/1023426/Whats-New-in-Csharp

    1. Auto property initializer 2. await in catch and finally block. 3. New way for Exception filters.

    With C# 6, you can now add the using static qualifier and reference Example:using static System.Console;namespace CSharpSix {class Program{static void Main(string[] args){WriteLine("Hello World!");}} }

    To explore new features in c#6 please refer to http://www.c-sharpcorner.com/UploadFile/201fc1/experimenting-with-C-Sharp-6s-new-features/