Click or drag to resize

CustomAttributeProviderExtensionsGetCustomAttributesT Method

Returns a list of custom attributes identified by the type. GetCustomAttributes(Type, Boolean)

Namespace:  TomsToolbox.Essentials
Assembly:  TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax
public static IEnumerable<T> GetCustomAttributes<T>(
	this ICustomAttributeProvider self,
	bool inherit
)

Parameters

self
Type: System.ReflectionICustomAttributeProvider
The member info of the object to evaluate.
inherit
Type: SystemBoolean
Specifies whether to search this member's inheritance chain to find the attributes.

Type Parameters

T
The type of attributes to return.

Return Value

Type: IEnumerableT
An array of custom attributes applied to this member, or an array with zero (0) elements if no attributes have been applied.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ICustomAttributeProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
TypeLoadExceptionA custom attribute type cannot be loaded
InvalidOperationExceptionThis member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context.
See Also