Share via


AttributeTable.GetCustomAttributes Method (Type, String)

Returns an enumeration of all attributes provided for the specified type and member name.

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

Syntax

'Declaration
Public Function GetCustomAttributes ( _
    ownerType As Type, _
    memberName As String _
) As IEnumerable
public IEnumerable GetCustomAttributes(
    Type ownerType,
    string memberName
)
public:
IEnumerable^ GetCustomAttributes(
    Type^ ownerType, 
    String^ memberName
)
member GetCustomAttributes : 
        ownerType:Type * 
        memberName:string -> IEnumerable 
public function GetCustomAttributes(
    ownerType : Type, 
    memberName : String
) : IEnumerable

Parameters

  • ownerType
    Type: System.Type
    The owning type of the dependency property.
  • memberName
    Type: System.String
    The name of the member to provide attributes for.

Return Value

Type: System.Collections.IEnumerable
An enumeration of attributes.

Exceptions

Exception Condition
ArgumentNullException

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

Remarks

This method never returns a nulla null reference (Nothing in Visual Basic) enumeration.

Examples

The following code example shows how to use the GetCustomAttributes method to get the custom attributes for a member. This code example is part of a larger example provided for the AttributeTable class.

Dim attrs1 As IEnumerable = attributes.GetCustomAttributes(GetType(Button), "Background")
IEnumerable attrs1 = attributes.GetCustomAttributes(
    typeof(Button),
    "Background");

.NET Framework Security

See Also

Reference

AttributeTable Class

GetCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTableBuilder