Condividi tramite


Metodo AttributeTableBuilder.AddCustomAttributes (Type, array<Attribute )

Aggiunge il contenuto degli attributi specificati al generatore di tabelle.

Spazio dei nomi:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Sintassi

'Dichiarazione
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[]
)

Parametri

  • type
    Tipo: System.Type
    Tipo cui aggiungere gli attributi a livello di classe.
  • attributes
    Tipo: array<System.Attribute[]
    Nuovi attributi da aggiungere a type.

Eccezioni

Eccezione Condizione
ArgumentNullException

type o attributes è nullriferimento null (Nothing in Visual Basic).

Note

I conflitti vengono risolti con una strategia "last in wins" (vince l'ultimo aggiornamento). Quando si compila una tabella di attributi di grandi dimensioni, utilizzare il metodo AddCallback per posticipare l'operazione di creazione degli attributi finché non sono necessari.

Esempi

Nell'esempio di codice seguente viene illustrato come aggiungere un attributo a un tipo. Questo esempio di codice fa parte di un esempio più completo fornito per la classe AttributeTableBuilder.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

AttributeTableBuilder Classe

Overload AddCustomAttributes

Spazio dei nomi Microsoft.Windows.Design.Metadata

AttributeTable

AttributeCallbackBuilder