March 2003
Intermediate to advanced
896 pages
32h 35m
English
DefaultValueAttribute
This attribute decorates a property to indicate its default value. The VS.NET designer will display a property that is set to its default value using a plain style, whereas non-default values will be displayed in bold.
You should ensure that the Value of the attribute
matches the initial value assigned to the property, as code
generators may choose not to persist default properties.
public sealed class DefaultValueAttribute : Attribute { // Public Constructors public DefaultValueAttribute(bool value); public DefaultValueAttribute(byte value); public DefaultValueAttribute(char value); public DefaultValueAttribute(double value); public DefaultValueAttribute(short value); public DefaultValueAttribute(int value); public DefaultValueAttribute(long value); public DefaultValueAttribute(object value); public DefaultValueAttribute(float value); public DefaultValueAttribute(string value); public DefaultValueAttribute(Type type, string value); // Public Instance Properties public object Value{get; } // Public Instance Methods public override bool Equals(object obj); // overrides Attribute public override int GetHashCode(); // overrides Attribute }
System.Object
→ System.Attribute → DefaultValueAttribute
All
Read now
Unlock full access