Default value for public attributes
- by Danny Chen
I have a public attribute in some class. I want a default value -1 for this attribute without an private variable like _MyAttr(because too many attributes, i won't add them one by one).
public int MyAttr { get; set; }
[DefaultValueAttribute] is not working for this issue i think. Any ideas? Thanks.