Freigeben über


RecommendedAsConfigurableAttribute.RecommendedAsConfigurable-Eigenschaft

Ruft einen Wert ab, der angibt, ob die Eigenschaft, an die dieses Attribut gebunden ist, als Anwendungseinstellung verwendet werden kann.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property RecommendedAsConfigurable As Boolean
'Usage
Dim instance As RecommendedAsConfigurableAttribute
Dim value As Boolean

value = instance.RecommendedAsConfigurable
public bool RecommendedAsConfigurable { get; }
public:
property bool RecommendedAsConfigurable {
    bool get ();
}
/** @property */
public boolean get_RecommendedAsConfigurable ()
public function get RecommendedAsConfigurable () : boolean

Eigenschaftenwert

true, wenn die Eigenschaft, an die dieses Attribut gebunden ist, als Anwendungseinstellung verwendet werden kann, andernfalls false.

Beispiel

Im folgenden Beispiel wird überprüft, ob MyProperty gebunden werden kann. Zunächst werden im Code die Attribute für MyProperty wie folgt abgerufen:

  • Abrufen einer PropertyDescriptorCollection mit allen Eigenschaften für das Objekt.

  • Abrufen von MyProperty über den Index in PropertyDescriptorCollection.

  • Speichern der Attribute für diese Eigenschaft in der Variablen attributes.

Anschließend wird im Code myAttribute auf den Wert des RecommendedAsConfigurableAttribute in der AttributeCollection festgelegt, und es wird überprüft, ob die Eigenschaft gebunden werden kann.

' 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
// 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.
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)
    .get_Item("MyProperty").get_Attributes();

// Checks to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute myAttribute = 
    ((RecommendedAsConfigurableAttribute)(attributes.get_Item
    (RecommendedAsConfigurableAttribute.class.ToType())));

if (myAttribute.get_RecommendedAsConfigurable()) {
    // Insert code here.
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

RecommendedAsConfigurableAttribute-Klasse
RecommendedAsConfigurableAttribute-Member
System.ComponentModel-Namespace
RecommendedAsConfigurableAttribute-Klasse
Attribute
PropertyDescriptor-Klasse
AttributeCollection-Klasse
PropertyDescriptorCollection-Klasse