Auto-property initializers - C# 6 Language New features

After release of C# 6 I feel, I took the right decision to choose C#. C# 6 have a bright future, then the other programming languages. Microsoft is continuously improving C# with new features and improved on every release. This time Instead of introducing new features Microsoft had improved existing features of C#. You can get a complete list of new features of C# 6 from Roslyn GitHub page. In this article I am going to show one of the new feature of C# 6.0 "Auto property initializers". We'll see what the improve Auto property with initializers.
auto-property-initializers-in-c

Take a simple example of class where I declared two properties. If I want to set the value of properties, then I have to declare constructor of a class, and using constructor I have to set values. However In reading application you have set values using constructor parameters.

In Previous version of C#
 public class Student
 {
   public string Name { get; set; }
   public string Email { get; set; }
   public Student()
   {
     Name = "Bhavik Patel";
     Email = "this.this@this.com";
   }
 }

In C# 6, Auto property Initializer can directly initialize value of any property. (It's most useful features for lazy programmers, who is not interested to write pieces of codes)
public class Student
{
  public string Name { get; set; } = "Bhavik Patel";
  public string Email { get; set; } = "this.this@this.com";
}

Another Example
public class Student
{
  public string Name { get;} = "Bhavik Patel";
}
It's showing Auto-property Initializer don't want both getter and setter in properties. I have set default value so no need to specify setter explicitly.

Don't forgot to read my C# 6 language new features series

Summary : It may be a minor feature yet very useful for saving lines of code.

Resources
https://github.com/dotnet/roslyn/wiki/Languages-features-in-C%23-6-and-VB-14
http://prasadhonrao.com/c-6-0-language-features-auto-property-initializer/