BrowsableAttribute.Browsable Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt een waarde opgehaald die aangeeft of een object wenkbrauwbaar is.
public:
property bool Browsable { bool get(); };
public bool Browsable { get; }
member this.Browsable : bool
Public ReadOnly Property Browsable As Boolean
Waarde van eigenschap
true als het object wenkbrauwbaar is; anders, false.
Voorbeelden
In het volgende voorbeeld wordt gecontroleerd of MyProperty wenkbrauwbaar is. Eerst haalt de code de kenmerken op door MyProperty :
Een met alle eigenschappen voor het object ophalen PropertyDescriptorCollection .
Indexeren in het PropertyDescriptorCollection bestand om op te halen
MyProperty.De kenmerken voor deze eigenschap opslaan in de kenmerkvariabele.
Vervolgens wordt de code ingesteld myAttribute op de waarde van de BrowsableAttribute in de AttributeCollection code en wordt gecontroleerd of de eigenschap wenkbrauwbaar is.
// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;
// Checks to see if the property is browsable.
BrowsableAttribute^ myAttribute = dynamic_cast<BrowsableAttribute^>(attributes[ BrowsableAttribute::typeid ]);
if ( myAttribute->Browsable )
{
// Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;
// Checks to see if the property is browsable.
BrowsableAttribute myAttribute = (BrowsableAttribute)attributes[typeof(BrowsableAttribute)];
if (myAttribute.Browsable)
{
// Insert code here.
}
' Gets the attributes for the property.
Dim attributes As AttributeCollection = TypeDescriptor.GetProperties(Me)("MyProperty").Attributes
' Checks to see if the property is browsable.
Dim myAttribute As BrowsableAttribute = CType(attributes(GetType(BrowsableAttribute)), BrowsableAttribute)
If myAttribute.Browsable Then
' Insert code here.
End If