BrowsableAttribute.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // System.ComponentModel.BrowsableAttribute.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. //
  12. namespace System.ComponentModel {
  13. [AttributeUsage (AttributeTargets.All)]
  14. public sealed class BrowsableAttribute : Attribute
  15. {
  16. private bool browsable;
  17. public static readonly BrowsableAttribute Default = new BrowsableAttribute (true);
  18. public static readonly BrowsableAttribute No = new BrowsableAttribute (false);
  19. public static readonly BrowsableAttribute Yes = new BrowsableAttribute (true);
  20. public BrowsableAttribute ()
  21. {
  22. }
  23. public BrowsableAttribute (bool browsable)
  24. {
  25. this.browsable = browsable;
  26. }
  27. public bool Browsable {
  28. get { return browsable; }
  29. }
  30. public override bool Equals (object obj)
  31. {
  32. if (!(obj is BrowsableAttribute))
  33. return false;
  34. if (obj == this)
  35. return true;
  36. return ((BrowsableAttribute) obj).Browsable == browsable;
  37. }
  38. public override int GetHashCode ()
  39. {
  40. return browsable.GetHashCode ();
  41. }
  42. public override bool IsDefaultAttribute ()
  43. {
  44. return browsable == BrowsableAttribute.Default.Browsable;
  45. }
  46. }
  47. }