Class MemberInfoExtensions
- Namespace
- DotEx.Reflections
- Assembly
- DotEx.dll
Extensions for MemberInfo.
public static class MemberInfoExtensions
- Inheritance
-
MemberInfoExtensions
- Inherited Members
Methods
GetMemberType(MemberInfo)
Gets the type of this member.
public static Type GetMemberType(this MemberInfo memberInfo)
Parameters
memberInfoMemberInfoMember info object.
Returns
- Type
Type of this member.
Exceptions
- ArgumentException
Member other that property, field, or method is provided.
GetValue(MemberInfo, object)
Returns the property/field value of a specified object.
public static object? GetValue(this MemberInfo memberInfo, object target)
Parameters
memberInfoMemberInfoMember info object
targetobjectTarget object to inspect.
Returns
- object
Property of field value.
Exceptions
- ArgumentException
Member other that property or field is provided.
IsDefined<TAttribute>(MemberInfo)
Indicates whether custom attributes of a specified type are applied to a specified member.
public static bool IsDefined<TAttribute>(this MemberInfo memberInfo) where TAttribute : Attribute
Parameters
memberInfoMemberInfoMember to inspect.
Returns
- bool
True if an attribute of the specified type is applied to element, otherwise false.
Type Parameters
TAttributeThe type of the attribute to search for.
IsDefined<TAttribute>(MemberInfo, bool)
Indicates whether custom attributes of a specified type are applied to a specified member, and optionally its ancestors.
public static bool IsDefined<TAttribute>(this MemberInfo memberInfo, bool inherit) where TAttribute : Attribute
Parameters
memberInfoMemberInfoMember to inspect.
inheritboolTrue to inspect the ancestors of element; otherwise, false.
Returns
- bool
True if an attribute of the specified type is applied to element, otherwise false.
Type Parameters
TAttributeThe type of the attribute to search for.
SetValue(MemberInfo, object, object)
Sets the property or field value of a specified target object,
accepts PropertyInfo or FieldInfo only.
public static void SetValue(this MemberInfo memberInfo, object target, object value)
Parameters
memberInfoMemberInfoMember info object.
targetobjectTarget object to set.
valueobjectValue to set.
Exceptions
- ArgumentException
Member other that property or field is provided.