Share via


AttributeTableBuilder.AddCustomAttributes Method (Type, String, array<Attribute )

Adds attributes to the member with the specified name.

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

Syntax

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

Parameters

  • ownerType
    Type: System.Type
    The owning type of the member.
  • memberName
    Type: System.String
    The member to add attributes for.

Exceptions

Exception Condition
ArgumentNullException

ownerType, memberName, or attributes is nulla null reference (Nothing in Visual Basic).

Remarks

The member can be a property or an event. The member is evaluated on demand when the user queries attributes on a specified property or event. Only property and event members are supported. All others are ignored.

Examples

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

' Apply the ReadOnlyAttribute to the Background property 
' of the Button class.
builder.AddCustomAttributes( _
    GetType(Button), _
    "Background", _
    New ReadOnlyAttribute(True))
// Apply the ReadOnlyAttribute to the Background property 
// of the Button class.
builder.AddCustomAttributes(
    typeof(Button),
    "Background",
    new ReadOnlyAttribute(true));

.NET Framework Security

See Also

Reference

AttributeTableBuilder Class

AddCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTable

AttributeCallbackBuilder