Metodo AttributeCallbackBuilder.AddCustomAttributes (String, array<Attribute )

Aggiunge attributi al membro con il nome specificato.

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

Sintassi

'Dichiarazione
Public Sub AddCustomAttributes ( _
    memberName As String, _
    ParamArray attributes As Attribute() _
)
public void AddCustomAttributes(
    string memberName,
    params Attribute[] attributes
)
public:
void AddCustomAttributes(
    String^ memberName, 
    ... array<Attribute^>^ attributes
)
member AddCustomAttributes : 
        memberName:string * 
        attributes:Attribute[] -> unit 
public function AddCustomAttributes(
    memberName : String, 
    ... attributes : Attribute[]
)

Parametri

  • memberName
    Tipo: System.String
    Membro per cui aggiungere attributi.Sono supportati solo i membri di tipo proprietà ed evento. Tutti gli altri verranno ignorati.
  • attributes
    Tipo: array<System.Attribute[]
    Matrice di nuovi attributi da aggiungere.

Eccezioni

Eccezione Condizione
ArgumentNullException

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

Note

Il membro può essere una proprietà o un evento. Il membro viene valutato su richiesta quando l'utente esegue una query per gli attributi su una proprietà o un evento specificato.

Esempi

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

// Apply the ReadOnlyAttribute to the Background property 
// of the Button class.
callbackBuilder.AddCustomAttributes(
    "Background",
    new ReadOnlyAttribute(true));

Sicurezza di .NET Framework

Vedere anche

Riferimenti

AttributeCallbackBuilder Classe

Overload AddCustomAttributes

Spazio dei nomi Microsoft.Windows.Design.Metadata

AttributeTableBuilder

AddCallback

AttributeTable