This topic has not yet been rated - Rate this topic

TypeBuilder.GetCustomAttributes Method (Type, Boolean)

Returns all the custom attributes of the current type that are assignable to a specified type.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)
public override Object[] GetCustomAttributes(
	Type attributeType,
	bool inherit
)

Parameters

attributeType
Type: System.Type
The type of attribute to search for. Only attributes that are assignable to this type are returned.
inherit
Type: System.Boolean
Specifies whether to search this member's inheritance chain to find the attributes.

Return Value

Type: System.Object[]
An array of custom attributes defined on the current type.

Implements

ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)
_MemberInfo.GetCustomAttributes(Type, Boolean)
ExceptionCondition
NotSupportedException

This method is not currently supported for incomplete types. Retrieve the type using GetType and call GetCustomAttributes on the returned Type.

ArgumentNullException

attributeType is null.

ArgumentException

The type must be a type provided by the underlying runtime system.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.