Class MemberInfoExtensions
Extension methods for
Inheritance
Namespace: X10D.Reflection
Assembly: X10D.dll
Syntax
public static class MemberInfoExtensions : object
Methods
| Improve this Doc View SourceHasCustomAttribute(MemberInfo, Type)
Returns a value indicating whether or not the current member has been decorated with a specified attribute.
Declaration
public static bool HasCustomAttribute(this MemberInfo member, Type attribute)
Parameters
Type | Name | Description |
---|---|---|
MemberInfo | member | The member attributes to check. |
Type | attribute | The attribute type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current member has been decorated with a specified attribute, or false otherwise. |
HasCustomAttribute<T>(MemberInfo)
Returns a value indicating whether or not the current member has been decorated with a specified attribute.
Declaration
public static bool HasCustomAttribute<T>(this MemberInfo member)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
MemberInfo | member | The member attributes to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current member has been decorated with a specified attribute, or false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The attribute type. |
SelectFromCustomAttribute<TAttribute, TReturn>(MemberInfo, Func<TAttribute, TReturn>)
Retrieves a custom attribute that is decorated by the current member, and projects it into to a new form.
Declaration
public static TReturn SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo member, Func<TAttribute, TReturn> selector)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
MemberInfo | member | The member. |
Func<TAttribute, TReturn> | selector | A transform function to apply to the attribute. |
Returns
Type | Description |
---|---|
TReturn | An instance of |
Type Parameters
Name | Description |
---|---|
TAttribute | The attribute type. |
TReturn | The return type of the |
SelectFromCustomAttribute<TAttribute, TReturn>(MemberInfo, Func<TAttribute, TReturn>, TReturn)
Retrieves a custom attribute that is decorated by the current member, and projects it into to a new form.
Declaration
public static TReturn SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo member, Func<TAttribute, TReturn> selector, TReturn defaultValue)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
MemberInfo | member | The member. |
Func<TAttribute, TReturn> | selector | A transform function to apply to the attribute. |
TReturn | defaultValue | The default value to return when the specified attribute is not found. |
Returns
Type | Description |
---|---|
TReturn | An instance of |
Type Parameters
Name | Description |
---|---|
TAttribute | The attribute type. |
TReturn | The return type of the |