Поделиться через


AttributeTableBuilder.AddCustomAttributes - метод (Type, String, array<Attribute[])

Добавление атрибутов к члену с заданным именем.

Пространство имен:  Microsoft.Windows.Design.Metadata
Сборка:  Microsoft.Windows.Design.Extensibility (в Microsoft.Windows.Design.Extensibility.dll)

Синтаксис

'Декларация
Public Sub AddCustomAttributes ( _
    ownerType As Type, _
    memberName As String, _
    ParamArray attributes As Attribute() _
)
public void AddCustomAttributes(
    Type ownerType,
    string memberName,
    params Attribute[] attributes
)
public:
void AddCustomAttributes(
    Type^ ownerType, 
    String^ memberName, 
    ... array<Attribute^>^ attributes
)
member AddCustomAttributes : 
        ownerType:Type * 
        memberName:string * 
        attributes:Attribute[] -> unit 
public function AddCustomAttributes(
    ownerType : Type, 
    memberName : String, 
    ... attributes : Attribute[]
)

Параметры

  • ownerType
    Тип: System.Type
    Тип владельца члена.
  • memberName
    Тип: System.String
    Член, к которому добавляются атрибуты.
  • attributes
    Тип: array<System.Attribute[]
    Добавляемые атрибуты.

Исключения

Исключение Условие
ArgumentNullException

Значение параметра ownerType, memberName или attributes равно nullпустая ссылка (Nothing в Visual Basic).

Заметки

В качестве члена выступает свойство или событие. Вычисление члена выполняется по требованию, если пользователь запрашивает атрибуты для заданного свойства или события. Поддерживаются только свойства и члены события. Другие члены не обрабатываются.

Примеры

В следующем примере показано, как добавить атрибут к члену. Данный пример кода является частью большого примера, приведенного в описании класса AttributeTableBuilder.

' Apply the ReadOnlyAttribute to the Background property 
' of the Button class.
builder.AddCustomAttributes( _
    GetType(Button), _
    "Background", _
    New ReadOnlyAttribute(True))
// Apply the ReadOnlyAttribute to the Background property 
// of the Button class.
builder.AddCustomAttributes(
    typeof(Button),
    "Background",
    new ReadOnlyAttribute(true));

Безопасность платформы .NET Framework

См. также

Ссылки

AttributeTableBuilder Класс

AddCustomAttributes - перегрузка

Microsoft.Windows.Design.Metadata - пространство имен

AttributeTable

AttributeCallbackBuilder