ControllerDescriptor.GetCustomAttributes Method (Type, Boolean)

Retrieves custom attributes of a specified type that are defined for this member, excluding named attributes.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
Public Overridable Function GetCustomAttributes ( _
    attributeType As Type, _
    inherit As Boolean _
) As Object()
public virtual Object[] GetCustomAttributes(
    Type attributeType,
    bool inherit
)
public:
virtual array<Object^>^ GetCustomAttributes(
    Type^ attributeType, 
    bool inherit
)

Parameters

  • attributeType
    Type: System.Type
    The type of the custom attributes.
  • inherit
    Type: System.Boolean
    true to look up the hierarchy chain for the inherited custom attribute; otherwise, false.

Return Value

Type: System.Object[]
An array of custom attributes, or an empty array if no custom attributes exist.

Implements

ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Exceptions

Exception Condition
TypeLoadException

The custom attribute type cannot be loaded.

AmbiguousMatchException

There is more than one attribute of type attributeType defined for this member.

ArgumentNullException

The attributeType parameter is null reference (Nothing in Visual Basic) (Nothing in Visual Basic).

See Also

Reference

ControllerDescriptor Class

GetCustomAttributes Overload

System.Web.Mvc Namespace