EditorBrowsableAttribute.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // System.ComponentModel.EditorBrowsableAttribute.cs
  3. //
  4. // Author:
  5. // Andreas Nahr ([email protected])
  6. //
  7. // (C) 2003 Andreas Nahr
  8. //
  9. //
  10. using System.ComponentModel;
  11. namespace System.ComponentModel
  12. {
  13. [AttributeUsage (AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Delegate |
  14. AttributeTargets.Enum | AttributeTargets.Event | AttributeTargets.Field |
  15. AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Property |
  16. AttributeTargets.Struct)]
  17. public sealed class EditorBrowsableAttribute : Attribute
  18. {
  19. private EditorBrowsableState state;
  20. public EditorBrowsableAttribute ()
  21. {
  22. this.state = EditorBrowsableState.Always;
  23. }
  24. public EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState state)
  25. {
  26. this.state = state;
  27. }
  28. public EditorBrowsableState State {
  29. get {
  30. return state;
  31. }
  32. }
  33. public override bool Equals (object obj)
  34. {
  35. if (!(obj is EditorBrowsableAttribute))
  36. return false;
  37. if (obj == this)
  38. return true;
  39. return ((EditorBrowsableAttribute) obj).State == state;
  40. }
  41. public override int GetHashCode ()
  42. {
  43. return state.GetHashCode ();
  44. }
  45. }
  46. }