RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Właściwość

Definicja

Pobiera wartość wskazującą, czy właściwość ta atrybut jest powiązana, może być używana jako ustawienie aplikacji.

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

Wartość właściwości

true jeśli właściwość ta atrybut jest powiązana, może być używana jako ustawienie aplikacji; w przeciwnym razie , false.

Przykłady

Poniższy przykład sprawdza, czy MyProperty można powiązać. Najpierw kod pobiera atrybuty dla MyProperty :

Następnie kod ustawia myAttribute wartość RecommendedAsConfigurableAttribute elementu w obiekcie AttributeCollection i sprawdza, czy właściwość jest powiązana.

// 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

Dotyczy

Zobacz też