Method GetCustomAttributes
GetCustomAttributes<T>(Type, bool)
Gets all attributes of a specific type on the specified type.
public static T[] GetCustomAttributes<T>(this Type type, bool inherit = true) where T : Attribute
Parameters
typeTypeThe type to get attributes from
inheritbooltrue if attributes should be inherited from base types
Returns
- T[]
An array of attributes applied to this type, or an empty array if no attributes are found.
Type Parameters
TThe type of attribute to get
GetCustomAttributes<T>(MemberInfo, bool)
Gets all attributes of a specific type on the specified member.
public static T[] GetCustomAttributes<T>(this MemberInfo member, bool inherit = true) where T : Attribute
Parameters
memberMemberInfoThe member to get attributes from
inheritbooltrue if attributes should be inherited from base types
Returns
- T[]
An array of attributes applied to this member, or an empty array if no attributes are found.
Type Parameters
TThe type of attribute to get