Class MemberUtils
Assembly: Xareus.Utils.dll
Syntax
public static class MemberUtils
Methods
GetCustomAttribute(MemberInfo, Type, bool, bool)
Get the custom attribute of a member. If the attribute is present multiple times, the first one is returned.
Note : As interfaces cannot contain fields, searching for the attribute in the interfaces of the declaring class with this member type makes no sense.
Declaration
public static Attribute GetCustomAttribute(this MemberInfo member, Type attributeType, bool inherit = false, bool inInterface = false)
Parameters
Type |
Name |
Description |
MemberInfo |
member |
|
Type |
attributeType |
|
bool |
inherit |
Look for the attribute in the parent classes of the declaring class
|
bool |
inInterface |
Look for the attribute in the interfaces of the declaring class
|
Returns
Exceptions
GetCustomAttribute<T>(MemberInfo, bool, bool)
Get the custom attribute of a member. If the attribute is present multiple times, the first one is returned.
Note : As interfaces cannot contain fields, searching for the attribute in the interfaces of the declaring class with this member type makes no sense.
Declaration
public static T GetCustomAttribute<T>(this MemberInfo member, bool inherit = false, bool inInterface = false) where T : Attribute
Parameters
Type |
Name |
Description |
MemberInfo |
member |
|
bool |
inherit |
Look for the attribute in the parent classes of the declaring class
|
bool |
inInterface |
Look for the attribute in the interfaces of the declaring class
|
Returns
Type Parameters
Exceptions
GetCustomAttributes<T>(MemberInfo, bool, bool)
Get all instances of the given custom attribute on a member.
Note : As interfaces cannot contain fields, searching for the attribute in the interfaces of the declaring class with this member type makes no sense.
Declaration
public static List<T> GetCustomAttributes<T>(this MemberInfo member, bool inherit = false, bool inInterface = false) where T : Attribute
Parameters
Type |
Name |
Description |
MemberInfo |
member |
|
bool |
inherit |
Look for the attribute in the parent classes of the declaring class
|
bool |
inInterface |
Look for the attribute in the interfaces of the declaring class
|
Returns
Type Parameters
Exceptions