New Features in C# 6.0 – Auto-Property Initializers

Initialize property is repetitive task, and cannot be done in the same line as we can can done for fields. For example we can write:

public class Person
 private string m_Name="Default Name";
 public string Name {get;set;}
 public Person()


As we can see Property can be initialized only in the constructor, beside the filed which can be initialized in the same line where it is declared. The new feature in C# 6.0 defines Auto-Property initializer alowing property to be initialized like fields. The following code snippet shows the Auto-Property Initializer;

public class Person
 static string m_Name="Default Name";
 static string Name {get;set;}=m_Name;

1 thought on “New Features in C# 6.0 – Auto-Property Initializers

  1. Live Interior 3D is flexible, allowint that you creaate 3D models,
    and detailed 2D floor plans as well. Vendor coupons are offered also on thee website, but
    you’ll receive a pack of coupons using your admission ticket.
    The ssimple facts are Tiffany had created an ‘all eyes on me’ Donna Faye Couture design foor my red carppet look.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s