BrowsableAttribute(Boolean) Konstruktor
Definice
Inicializuje novou instanci BrowsableAttribute třídy.Initializes a new instance of the BrowsableAttribute class.
public:
BrowsableAttribute(bool browsable);
public BrowsableAttribute (bool browsable);
new System.ComponentModel.BrowsableAttribute : bool -> System.ComponentModel.BrowsableAttribute
Public Sub New (browsable As Boolean)
Parametry
- browsable
- Boolean
true
Pokud lze změnit vlastnost nebo událost v době návrhu; v opačném případě false
.true
if a property or event can be modified at design time; otherwise, false
. Výchozí formát je true
.The default is true
.
Příklady
Následující příklad označí vlastnost jako proprocházetelné.The following example marks a property as browsable. Tento kód vytvoří novou BrowsableAttribute hodnotu a nastaví její hodnotu na BrowsableAttribute.Yes a naváže ji na vlastnost.This code creates a new BrowsableAttribute, sets its value to BrowsableAttribute.Yes, and binds it to the property.
[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
Poznámky
Když označíte vlastnost BrowsableAttribute konstruktorem hodnoty true
, hodnota tohoto atributu je nastavena na konstantního člena Yes .When you mark a property with the BrowsableAttribute constructor of the value true
, the value of this attribute is set to the constant member Yes. Pro vlastnost označenou BrowsableAttribute konstruktorem hodnoty false
je hodnota No .For a property marked with the BrowsableAttribute constructor of the value false
, the value is No. Proto pokud chcete zjistit hodnotu tohoto atributu v kódu, je nutné zadat atribut jako BrowsableAttribute.Yes nebo BrowsableAttribute.No .Therefore, when you want to check the value of this attribute in your code, you must specify the attribute as BrowsableAttribute.Yes or BrowsableAttribute.No.