mscorlib(4.0.0.0) API with additions
DesignOnlyAttribute.cs
1 namespace System.ComponentModel
2 {
4  [AttributeUsage(AttributeTargets.All)]
5  public sealed class DesignOnlyAttribute : Attribute
6  {
7  private bool isDesignOnly;
8 
10  public static readonly DesignOnlyAttribute Yes = new DesignOnlyAttribute(isDesignOnly: true);
11 
13  public static readonly DesignOnlyAttribute No = new DesignOnlyAttribute(isDesignOnly: false);
14 
16  public static readonly DesignOnlyAttribute Default = No;
17 
21  public bool IsDesignOnly => isDesignOnly;
22 
26  public DesignOnlyAttribute(bool isDesignOnly)
27  {
28  this.isDesignOnly = isDesignOnly;
29  }
30 
34  public override bool IsDefaultAttribute()
35  {
37  }
38 
43  public override bool Equals(object obj)
44  {
45  if (obj == this)
46  {
47  return true;
48  }
49  DesignOnlyAttribute designOnlyAttribute = obj as DesignOnlyAttribute;
50  if (designOnlyAttribute != null)
51  {
52  return designOnlyAttribute.isDesignOnly == isDesignOnly;
53  }
54  return false;
55  }
56 
59  public override int GetHashCode()
60  {
61  return isDesignOnly.GetHashCode();
62  }
63  }
64 }
DesignOnlyAttribute(bool isDesignOnly)
Initializes a new instance of the T:System.ComponentModel.DesignOnlyAttribute class.
override bool Equals(object obj)
Returns whether the value of the given object is equal to the current T:System.ComponentModel....
Represents the base class for custom attributes.
Definition: Attribute.cs:15
override bool IsDefaultAttribute()
Determines if this attribute is the default.
static readonly DesignOnlyAttribute No
Specifies that a property can be set at design time or at run time. This static field is read-only.
AttributeTargets
Specifies the application elements on which it is valid to apply an attribute.
Specifies whether a property can only be set at design time.
bool IsDesignOnly
Gets a value indicating whether a property can be set only at design time.
static readonly DesignOnlyAttribute Yes
Specifies that a property can be set only at design time. This static field is read-only.
static readonly DesignOnlyAttribute Default
Specifies the default value for the T:System.ComponentModel.DesignOnlyAttribute, which is F:System....
override int GetHashCode()
Returns the hash code for this instance.