EditorBrowsableAttribute.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. {
  30. get
  31. {
  32. return state;
  33. }
  34. }
  35. public override bool Equals (object obj)
  36. {
  37. if (!(obj is EditorBrowsableAttribute))
  38. return false;
  39. if (obj == this)
  40. return true;
  41. return ((EditorBrowsableAttribute) obj).State == state;
  42. }
  43. public override int GetHashCode ()
  44. {
  45. return state.GetHashCode ();
  46. }
  47. }
  48. }
  49. // Old implementation
  50. //using System;
  51. //
  52. //
  53. //
  54. //namespace System.ComponentModel
  55. //{
  56. //
  57. // /// <summary>
  58. // /// Specifies that a property or method is viewable in an editor. This class cannot be inherited.
  59. // /// </summary>
  60. //
  61. // [MonoTODO("Missing description for State. Only minimal testing.")]
  62. //
  63. // [AttributeUsage(
  64. //
  65. // AttributeTargets.Class|
  66. //
  67. // AttributeTargets.Constructor|
  68. //
  69. // AttributeTargets.Delegate|
  70. //
  71. // AttributeTargets.Enum|
  72. //
  73. // AttributeTargets.Event|
  74. //
  75. // AttributeTargets.Field|
  76. //
  77. // AttributeTargets.Interface|
  78. //
  79. // AttributeTargets.Method|
  80. //
  81. // AttributeTargets.Property|
  82. //
  83. // AttributeTargets.Struct)]
  84. //
  85. // public sealed class EditorBrowsableAttribute : Attribute
  86. //
  87. // {
  88. //
  89. // private System.ComponentModel.EditorBrowsableState state;
  90. //
  91. //
  92. //
  93. // /// <summary>
  94. //
  95. // /// FIXME: Summary description for State.
  96. //
  97. // /// </summary>
  98. //
  99. // public System.ComponentModel.EditorBrowsableState State
  100. //
  101. // {
  102. //
  103. // get
  104. //
  105. // {
  106. //
  107. // return state;
  108. //
  109. // }
  110. //
  111. // }
  112. //
  113. //
  114. //
  115. // /// <summary>
  116. //
  117. // /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState.
  118. //
  119. // /// </summary>
  120. //
  121. // /// <param name="state">The System.ComponentModel.EditorBrowsableState to set System.ComponentModel.EditorBrowsableAttribute.State to.</param>
  122. //
  123. // public EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state)
  124. //
  125. // {
  126. //
  127. // this.state = state;
  128. //
  129. // }
  130. //
  131. //
  132. //
  133. // /// <summary>
  134. //
  135. // /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState == System.ComponentModel.EditorBrowsableState.Always.
  136. //
  137. // /// </summary>
  138. //
  139. // public EditorBrowsableAttribute()
  140. //
  141. // {
  142. //
  143. // this.state = System.ComponentModel.EditorBrowsableState.Always;
  144. //
  145. // }
  146. //
  147. // }
  148. //
  149. //}