Show / Hide Table of Contents

Class ReflectionHelper

Inheritance
System.Object
ReflectionHelper
Namespace: Volo.Abp.Reflection
Assembly: Volo.Abp.Core.dll
Syntax
public static class ReflectionHelper : object

Methods

GetAttributesOfMemberOrDeclaringType<TAttribute>(MemberInfo, Boolean)

Tries to gets attributes defined for a class member and it's declaring type including inherited attributes.

Declaration
public static IEnumerable<TAttribute> GetAttributesOfMemberOrDeclaringType<TAttribute>(MemberInfo memberInfo, bool inherit = true)

    where TAttribute : class
Parameters
Type Name Description
MemberInfo memberInfo

MemberInfo

System.Boolean inherit

Inherit attribute from base classes

Returns
Type Description
IEnumerable<TAttribute>
Type Parameters
Name Description
TAttribute

Type of the attribute

GetImplementedGenericTypes(Type, Type)

Declaration
public static List<Type> GetImplementedGenericTypes(Type givenType, Type genericType)
Parameters
Type Name Description
Type givenType
Type genericType
Returns
Type Description
List<Type>

GetPublicConstantsRecursively(Type)

Get all the constant values in the specified type (including the base type).

Declaration
public static string[] GetPublicConstantsRecursively(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
System.String[]

GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<TAttribute>(MemberInfo, TAttribute, Boolean)

Tries to gets an of attribute defined for a class member and it's declaring type including inherited attributes. Returns default value if it's not declared at all.

Declaration
public static TAttribute GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<TAttribute>(MemberInfo memberInfo, TAttribute defaultValue = null, bool inherit = true)

    where TAttribute : class
Parameters
Type Name Description
MemberInfo memberInfo

MemberInfo

TAttribute defaultValue

Default value (null as default)

System.Boolean inherit

Inherit attribute from base classes

Returns
Type Description
TAttribute
Type Parameters
Name Description
TAttribute

Type of the attribute

GetSingleAttributeOrDefault<TAttribute>(MemberInfo, TAttribute, Boolean)

Tries to gets an of attribute defined for a class member and it's declaring type including inherited attributes. Returns default value if it's not declared at all.

Declaration
public static TAttribute GetSingleAttributeOrDefault<TAttribute>(MemberInfo memberInfo, TAttribute defaultValue = null, bool inherit = true)

    where TAttribute : Attribute
Parameters
Type Name Description
MemberInfo memberInfo

MemberInfo

TAttribute defaultValue

Default value (null as default)

System.Boolean inherit

Inherit attribute from base classes

Returns
Type Description
TAttribute
Type Parameters
Name Description
TAttribute

Type of the attribute

GetValueByPath(Object, Type, String)

Gets value of a property by it's full path from given object

Declaration
public static object GetValueByPath(object obj, Type objectType, string propertyPath)
Parameters
Type Name Description
System.Object obj
Type objectType
System.String propertyPath
Returns
Type Description
System.Object

IsAssignableToGenericType(Type, Type)

Checks whether givenType implements/inherits genericType.

Declaration
public static bool IsAssignableToGenericType(Type givenType, Type genericType)
Parameters
Type Name Description
Type givenType

Type to check

Type genericType

Generic type

Returns
Type Description
System.Boolean
Back to top Powered by Volosoft