Partager via


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

Ajoute le contenu des attributs fournis au générateur de tables.

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

Syntaxe

'Déclaration
Public Sub AddCustomAttributes ( _
    type As Type, _
    ParamArray attributes As Attribute() _
)
public void AddCustomAttributes(
    Type type,
    params Attribute[] attributes
)
public:
void AddCustomAttributes(
    Type^ type, 
    ... array<Attribute^>^ attributes
)
member AddCustomAttributes : 
        type:Type * 
        attributes:Attribute[] -> unit 
public function AddCustomAttributes(
    type : Type, 
    ... attributes : Attribute[]
)

Paramètres

  • type
    Type : System.Type
    Type auquel ajouter des attributs de niveau classe.
  • attributes
    Type : array<System.Attribute[]
    Nouveaux attributs à ajouter à type.

Exceptions

Exception Condition
ArgumentNullException

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

Notes

Les conflits sont résolus à l'aide d'une stratégie de priorité aux dernières modifications. Lors de la génération d'une grande table d'attributs, utilisez la méthode AddCallback pour différer le travail de création d'attributs jusqu'à ce qu'ils soient nécessaires.

Exemples

L'exemple de code suivant indique comment ajouter un attribut à un type. Cet exemple de code fait partie d'un exemple plus complet fourni pour la classe AttributeTableBuilder.

builder.AddCustomAttributes( _
    GetType(Button), _
    New DefaultPropertyAttribute("Content"))
builder.AddCustomAttributes(
    typeof(Button),
    new DefaultPropertyAttribute("Content"));

Sécurité .NET Framework

Voir aussi

Référence

AttributeTableBuilder Classe

AddCustomAttributes, surcharge

Microsoft.Windows.Design.Metadata, espace de noms

AttributeTable

AttributeCallbackBuilder