Assign default property value

  • Thread starter Thread starter Guest
  • Start date Start date
Use the [DefaultValueAttribute] or use the ShouldSerialize<propertyname> and
Reset<propertyname>.
 
Also, if your property is exposing a value type private variable in your
class, then use an initializer to set that variable to the default value. I
have had problems with the DefaultValueAttribute when I did not correctly
initialize the underlying variable. (Don't remember exactly what - I haven't
done that recently :-))
-Rachel

Relaxin said:
Use the [DefaultValueAttribute] or use the ShouldSerialize<propertyname>
and Reset<propertyname>.


Job Lot said:
how can i assign a default value for a custom property?
 
Back
Top