I've heard people say a few different things about the DefaultValue
attribute including:
-
"It sets the value of the property before anything else uses it."
-
"It doesn't work for autoproperties."
-
"It's only for decoration. You must manually set actual default values."
Which (if any) is right? Does DefaultValue
actually set default values? Are there cases where it doesn't work? Is it best just not to use it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…