Shift Nibble

Happy Coding ...

How do you give a C# Auto-Property a default value?

You can achieve it by setting default value in the constructor of the class.

See example below

Example #1

class Person
{
  Person()
  {

  FirstName="Default Name";

  }

  FirstName { get;set; }

}

Loading