BrowsableAttribute.Browsable Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene un valore che indica se un oggetto è esplorabile.
public:
property bool Browsable { bool get(); };
public bool Browsable { get; }
member this.Browsable : bool
Public ReadOnly Property Browsable As Boolean
Valore della proprietà
true se l'oggetto è esplorabile; in caso contrario, false.
Esempio
Nell'esempio seguente viene verificato se MyProperty è esplorabile. Prima di tutto, il codice ottiene gli attributi per MyProperty per:
Recupero di un PropertyDescriptorCollection oggetto con tutte le proprietà per l'oggetto .
Indicizzazione in PropertyDescriptorCollection per ottenere
MyProperty.Salvataggio degli attributi per questa proprietà nella variabile degli attributi.
Il codice imposta myAttribute quindi sul valore di BrowsableAttribute in AttributeCollection e controlla se la proprietà è esplorabile.
// 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