RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Proprietà

Definizione

Ottiene un valore che indica se la proprietà alla quale è associato questo attributo può essere utilizzata come impostazione dell'applicazione.

public:
 property bool RecommendedAsConfigurable { bool get(); };
public bool RecommendedAsConfigurable { get; }
member this.RecommendedAsConfigurable : bool
Public ReadOnly Property RecommendedAsConfigurable As Boolean

Valore della proprietà

true se la proprietà a cui è associato questo attributo può essere utilizzata come impostazione dell'applicazione, false in caso contrario.

Esempio

Nell'esempio seguente viene verificato se MyProperty è associabile. Prima di tutto, il codice ottiene gli attributi per MyProperty per:

Il codice imposta myAttribute quindi sul valore di RecommendedAsConfigurableAttribute in AttributeCollection e controlla se la proprietà è associabile.

// Gets the attributes for the property.
AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;

// Checks to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast<RecommendedAsConfigurableAttribute^>(attributes[ RecommendedAsConfigurableAttribute::typeid ]);
if ( myAttribute->RecommendedAsConfigurable )
{
   // Insert code here.
}
// Gets the attributes for the property.
AttributeCollection attributes = 
   TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;

// Checks to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute myAttribute = 
   (RecommendedAsConfigurableAttribute)attributes[typeof(RecommendedAsConfigurableAttribute)];
if(myAttribute.RecommendedAsConfigurable) {
   // 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 recommended as configurable.
Dim myAttribute As RecommendedAsConfigurableAttribute = _
   CType(attributes(GetType(RecommendedAsConfigurableAttribute)), _
   RecommendedAsConfigurableAttribute)
   
If myAttribute.RecommendedAsConfigurable Then
    ' Insert code here.
End If

Si applica a

Vedi anche