BrowsableAttribute(Boolean) 构造函数 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 BrowsableAttribute 类的新实例。
public:
 BrowsableAttribute(bool browsable);public BrowsableAttribute (bool browsable);new System.ComponentModel.BrowsableAttribute : bool -> System.ComponentModel.BrowsableAttributePublic Sub New (browsable As Boolean)参数
- browsable
- Boolean
如果属性或事件可以在设计时修改,则为 true;否则为 false。 默认值为 true。
示例
以下示例将属性标记为可浏览。 此代码创建一个新的 BrowsableAttribute,将其值设置为 BrowsableAttribute.Yes,并将其绑定到 属性。
   [Browsable(true)]
   int get()
   {
      // Insert code here.
      return 0;
   }
   void set( int value )
   {
      
      // Insert code here.
   }
}
[Browsable(true)]
public int MyProperty
{
    get
    {
        // Insert code here.
        return 0;
    }
    set
    {
        // Insert code here.
    }
}
<Browsable(True)> _
Public Property MyProperty() As Integer
    Get
        ' Insert code here.
        Return 0
    End Get
    Set
        ' Insert code here.
    End Set
End Property
注解
使用 值的true构造函数标记属性BrowsableAttribute时,此属性的值设置为常量成员 Yes。 对于使用 BrowsableAttribute 值的 false构造函数标记的属性,值为 No。 因此,如果要在代码中检查此属性的值,则必须将特性指定为 BrowsableAttribute.Yes 或 BrowsableAttribute.No。