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


CodeTypeParameter.CustomAttributes Свойство

Определение

Возвращает настраиваемые атрибуты параметра типа.

public:
 property System::CodeDom::CodeAttributeDeclarationCollection ^ CustomAttributes { System::CodeDom::CodeAttributeDeclarationCollection ^ get(); };
public System.CodeDom.CodeAttributeDeclarationCollection CustomAttributes { get; }
member this.CustomAttributes : System.CodeDom.CodeAttributeDeclarationCollection
Public ReadOnly Property CustomAttributes As CodeAttributeDeclarationCollection

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

Значение, CodeAttributeDeclarationCollection указывающее настраиваемые атрибуты параметра типа. Значение по умолчанию — null.

Примеры

В следующем примере кода показано использование CustomAttributes свойства для добавления нового настраиваемого атрибута. Этот пример является частью более крупного примера, предоставленного CodeTypeParameter для класса.

kType.CustomAttributes.Add(new CodeAttributeDeclaration(
    "System.ComponentModel.DescriptionAttribute",
        new CodeAttributeArgument(new CodePrimitiveExpression("KeyType"))));
kType.CustomAttributes.Add _
    (New CodeAttributeDeclaration("System.ComponentModel.DescriptionAttribute", _
        New CodeAttributeArgument(New CodePrimitiveExpression("KeyType"))))

Комментарии

Это свойство можно использовать для добавления атрибутов метаданных в объявление параметра типа.

Предостережение

Это свойство null по умолчанию и должно быть проверено перед ссылкой.

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

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