In the past we declared classes and can change the default value of a property like this:
public class MyClass
{
private string name;
public string Name
{
get{ if(name==null) return ""; }
set{ name= value; }
}
}
Now we can do:
public class MyClass
{
public string Name {get; set;}
}
But how to change the default value in this way? For example, if the name is null
, I want to get ""
instead of null
?