DesignOnlyAttribute.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // System.ComponentModel.DesignOnlyAttribute.cs
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) Ximian, Inc. http://www.ximian.com
  9. // (C) 2003 Andreas Nahr
  10. //
  11. namespace System.ComponentModel {
  12. [AttributeUsage (AttributeTargets.Property)]
  13. public sealed class DesignOnlyAttribute : Attribute
  14. {
  15. private bool design_only;
  16. public static readonly DesignOnlyAttribute Default = new DesignOnlyAttribute (false);
  17. public static readonly DesignOnlyAttribute No = new DesignOnlyAttribute (false);
  18. public static readonly DesignOnlyAttribute Yes = new DesignOnlyAttribute (true);
  19. public DesignOnlyAttribute (bool design_only)
  20. {
  21. this.design_only = design_only;
  22. }
  23. public bool IsDesignOnly {
  24. get { return design_only; }
  25. }
  26. public override bool Equals (object obj)
  27. {
  28. if (!(obj is DesignOnlyAttribute))
  29. return false;
  30. if (obj == this)
  31. return true;
  32. return ((DesignOnlyAttribute) obj).IsDesignOnly == design_only;
  33. }
  34. public override int GetHashCode ()
  35. {
  36. return design_only.GetHashCode ();
  37. }
  38. public override bool IsDefaultAttribute ()
  39. {
  40. return design_only == DesignOnlyAttribute.Default.IsDesignOnly;
  41. }
  42. }
  43. }