BrowsableAttribute.Browsable Eigenschap

Definitie

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 :

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

Van toepassing op

Zie ook