Bagikan melalui


RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Properti

Definisi

Mendapatkan nilai yang menunjukkan apakah properti yang terikat atribut ini dapat digunakan sebagai pengaturan aplikasi.

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

Nilai Properti

true jika properti atribut ini terikat untuk dapat digunakan sebagai pengaturan aplikasi; jika tidak, false.

Contoh

Contoh berikut memeriksa untuk melihat apakah MyProperty dapat diikat. Pertama, kode mendapatkan atribut untuk MyProperty dengan:

Kemudian kode diatur myAttribute ke nilai RecommendedAsConfigurableAttribute di AttributeCollection dan memeriksa apakah properti dapat diikat.

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

Berlaku untuk

Lihat juga