AttributeTableBuilder.AddCustomAttributes, méthode (Type, String, array<Attribute )

Ajoute des attributs au membre qui porte le nom spécifié.

Espace de noms :  Microsoft.Windows.Design.Metadata
Assembly :  Microsoft.Windows.Design.Extensibility (dans Microsoft.Windows.Design.Extensibility.dll)

Syntaxe

'Déclaration
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[]
)

Paramètres

  • ownerType
    Type : System.Type
    Type propriétaire du membre.
  • memberName
    Type : System.String
    Membre auquel ajouter des attributs.

Exceptions

Exception Condition
ArgumentNullException

ownerType, memberName ou attributes est nullune référence null (Nothing en Visual Basic).

Notes

Le membre peut être une propriété ou un événement. Le membre est évalué à la demande lorsque l'utilisateur interroge les attributs sur une propriété ou un événement spécifié. Seuls les membres de propriété et d'événement sont pris en charge. Tous les autres sont ignorés.

Exemples

L'exemple de code suivant indique comment ajouter un attribut à un membre. Cet exemple de code fait partie d'un exemple plus complet fourni pour la classe 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));

Sécurité .NET Framework

Voir aussi

Référence

AttributeTableBuilder Classe

AddCustomAttributes, surcharge

Microsoft.Windows.Design.Metadata, espace de noms

AttributeTable

AttributeCallbackBuilder