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
- Confiance totale accordée à l'appelant immédiat. Ce membre ne peut pas être utilisé par du code d'un niveau de confiance partiel. Pour plus d'informations, consultez Utilisation de bibliothèques à partir de code d'un niveau de confiance partiel.
Voir aussi
Référence
AddCustomAttributes, surcharge