RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Свойство

Определение

Возвращает значение, показывающее, может ли свойство, с которым связан этот атрибут, быть использовано в качестве параметра приложения.

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

Значение свойства

Значение true, если свойство, с которым связан этот атрибут, может быть использовано в качестве параметра приложения; в противном случае — значение false.

Примеры

В следующем примере проверяется возможность привязки MyProperty . Сначала код получает атрибуты для MyProperty :

  • PropertyDescriptorCollection Получение со всеми свойствами объекта .

  • Индексирование в для PropertyDescriptorCollection получения MyProperty.

  • Сохранение атрибутов для этого свойства в переменной attributes.

Затем код задает myAttribute значение RecommendedAsConfigurableAttribute в AttributeCollection и проверяет, является ли свойство привязываемым.

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

Применяется к

См. также раздел