Dela via


AttributeTableBuilder.AddCustomAttributes Method (Type, array<Attribute )

Adds the contents of the provided attributes to the table builder.

Namespace:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

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

Parameters

  • type
    Type: System.Type
    The type to add class-level attributes to.

Exceptions

Exception Condition
ArgumentNullException

type or attributes is nulla null reference (Nothing in Visual Basic).

Remarks

Conflicts are resolved with a last-in-wins strategy. When building a large attribute table, use the AddCallback method to defer the work of creating attributes until they are needed.

Examples

The following code example shows how to add an attribute to a type. This code example is part of a larger example provided for the AttributeTableBuilder class.

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

.NET Framework Security

See Also

Reference

AttributeTableBuilder Class

AddCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTable

AttributeCallbackBuilder