Table of Contents

Class ReflectionUtils

Namespace
JJMasterData.Commons.Util
Assembly
JJMasterData.Commons.dll
public static class ReflectionUtils
Inheritance
ReflectionUtils
Inherited Members

Methods

GetDefinedTypes<T>(IEnumerable<Assembly>)

public static IEnumerable<TypeInfo> GetDefinedTypes<T>(IEnumerable<Assembly> assemblies)

Parameters

assemblies IEnumerable<Assembly>

Returns

IEnumerable<TypeInfo>

Type Parameters

T

GetStaticProperty(string, string)

Retrieves a value from a static property by specifying a type full name and property

public static object GetStaticProperty(string typeName, string property)

Parameters

typeName string

Full type name (namespace.class)

property string

Property to get value from

Returns

object

GetStaticProperty(Type, string)

Returns a static property from a given type

public static object GetStaticProperty(Type type, string property)

Parameters

type Type

Type instance for the static property

property string

Property name as a string

Returns

object

GetTypeFromName(string, string)

Helper routine that looks up a type name and tries to retrieve the full type reference using GetType() and if not found looking in the actively executing assemblies and optionally loading the specified assembly name.

public static Type GetTypeFromName(string typeName, string assemblyName = null)

Parameters

typeName string

type to load

assemblyName string

Optional assembly name to load from if type cannot be loaded initially. Use for lazy loading of assemblies without taking a type dependency.

Returns

Type

null

GetTypeFromProperty<T>(IEnumerable<Assembly>)

public static IEnumerable<TypeInfo> GetTypeFromProperty<T>(IEnumerable<Assembly> assemblies)

Parameters

assemblies IEnumerable<Assembly>

Returns

IEnumerable<TypeInfo>

Type Parameters

T

IsMethodImplemented(Type, string)

public static bool IsMethodImplemented(Type type, string methodName)

Parameters

type Type
methodName string

Returns

bool

LoadAssembly(string)

Try to load an assembly into the application's app domain. Loads by name first then checks for filename

public static Assembly LoadAssembly(string assemblyName)

Parameters

assemblyName string

Assembly name or full path

Returns

Assembly

null on failure