BrowsableAttribute.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 (bool browsable)
  21. {
  22. this.browsable = browsable;
  23. }
  24. public bool Browsable {
  25. get { return browsable; }
  26. }
  27. public override bool Equals (object obj)
  28. {
  29. if (!(obj is BrowsableAttribute))
  30. return false;
  31. if (obj == this)
  32. return true;
  33. return ((BrowsableAttribute) obj).Browsable == browsable;
  34. }
  35. public override int GetHashCode ()
  36. {
  37. return browsable.GetHashCode ();
  38. }
  39. public override bool IsDefaultAttribute ()
  40. {
  41. return browsable == BrowsableAttribute.Default.Browsable;
  42. }
  43. }
  44. }