AttributeTable.GetCustomAttributes Method (Type)

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

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

Syntax

'Declaration
Public Function GetCustomAttributes ( _
    type As Type _
) As IEnumerable
public IEnumerable GetCustomAttributes(
    Type type
)
public:
IEnumerable^ GetCustomAttributes(
    Type^ type
)
member GetCustomAttributes : 
        type:Type -> IEnumerable 
public function GetCustomAttributes(
    type : Type
) : IEnumerable

Parameters

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

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

type 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 type. This code example is part of a larger example provided for the AttributeTable class.

Dim attrs0 As IEnumerable = attributes.GetCustomAttributes(GetType(Button))
IEnumerable attrs0 = attributes.GetCustomAttributes(typeof(Button));

.NET Framework Security

See Also

Reference

AttributeTable Class

GetCustomAttributes Overload

Microsoft.Windows.Design.Metadata Namespace

AttributeTableBuilder