DekGenius.com
[ Team LiB ] Previous Section Next Section

DefaultValueAttribute

System.ComponentModel (system.dll)sealed class

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
}

Hierarchy

System.Object System.Attribute DefaultValueAttribute

Valid On

All

    [ Team LiB ] Previous Section Next Section