Can I generate in C# auto-property with default value?
public class MyClass
{
MyClass()
{
Reason = "my reason";
}
public string Reason{ get; set; }
}
Can I generate in C# auto-property with default value?
public class MyClass
{
MyClass()
{
Reason = "my reason";
}
public string Reason{ get; set; }
}
Yes, but to be able to create an instance from outside your class, make your constructor public.