Default Values for Properties

suggest change

Setting a default value can be done by using Initializers (C#6)

public class Name 
{
    public string First { get; set; } = "James";
    public string Last { get; set; } = "Smith";
}

If it is read only you can return values like this:

public class Name 
  {
      public string First => "James";
      public string Last => "Smith";
  }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents