mscorlib(4.0.0.0) API with additions
DescriptionAttribute.cs
1 namespace System.ComponentModel
2 {
4  [AttributeUsage(AttributeTargets.All)]
6  {
8  public static readonly DescriptionAttribute Default = new DescriptionAttribute();
9 
10  private string description;
11 
14  public virtual string Description => DescriptionValue;
15 
18  protected string DescriptionValue
19  {
20  get
21  {
22  return description;
23  }
24  set
25  {
26  description = value;
27  }
28  }
29 
32  : this(string.Empty)
33  {
34  }
35 
38  public DescriptionAttribute(string description)
39  {
40  this.description = description;
41  }
42 
47  public override bool Equals(object obj)
48  {
49  if (obj == this)
50  {
51  return true;
52  }
53  DescriptionAttribute descriptionAttribute = obj as DescriptionAttribute;
54  if (descriptionAttribute != null)
55  {
56  return descriptionAttribute.Description == Description;
57  }
58  return false;
59  }
60 
63  public override int GetHashCode()
64  {
65  return Description.GetHashCode();
66  }
67 
71  public override bool IsDefaultAttribute()
72  {
73  return Equals(Default);
74  }
75  }
76 }
DescriptionAttribute(string description)
Initializes a new instance of the T:System.ComponentModel.DescriptionAttribute class with a descripti...
Represents the base class for custom attributes.
Definition: Attribute.cs:15
override int GetHashCode()
Returns the hash code for this instance.
override bool Equals(object obj)
Returns whether the value of the given object is equal to the current T:System.ComponentModel....
string DescriptionValue
Gets or sets the string stored as the description.
AttributeTargets
Specifies the application elements on which it is valid to apply an attribute.
Specifies a description for a property or event.
static readonly DescriptionAttribute Default
Specifies the default value for the T:System.ComponentModel.DescriptionAttribute, which is an empty s...
virtual string Description
Gets the description stored in this attribute.
override bool IsDefaultAttribute()
Returns a value indicating whether this is the default T:System.ComponentModel.DescriptionAttribute i...
DescriptionAttribute()
Initializes a new instance of the T:System.ComponentModel.DescriptionAttribute class with no paramete...