RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Bu özniteliğin bağlı olduğu özelliğin bir uygulama ayarı olarak kullanılıp kullanılamayacağını belirten bir değer alır.
public:
property bool RecommendedAsConfigurable { bool get(); };
public bool RecommendedAsConfigurable { get; }
member this.RecommendedAsConfigurable : bool
Public ReadOnly Property RecommendedAsConfigurable As Boolean
Özellik Değeri
true
bu özniteliğin bağlı olduğu özellik bir uygulama ayarı olarak kullanılabilirse; aksi takdirde , false
.
Örnekler
Aşağıdaki örnek bağlanabilir olup olmadığını MyProperty
denetler. İlk olarak kod için öznitelikleri MyProperty
alır:
Nesnenin tüm özellikleriyle bir PropertyDescriptorCollection alınıyor.
almak için dizinini PropertyDescriptorCollection oluşturma
MyProperty
.Bu özelliğin öznitelikleri öznitelikler değişkenine kaydediliyor.
Ardından kod içindeki AttributeCollection değerine RecommendedAsConfigurableAttribute ayarlanır myAttribute
ve özelliğin bağlanabilir olup olmadığını denetler.
// 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
Şunlara uygulanır
Ayrıca bkz.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin