Reflector Class

Provides reflection routines on objects that are in most case faster than standard System.Reflection ways.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public static class Reflector
Inheritance
Object    Reflector

Methods

CreateInstance(ConstructorInfo, Object) Creates a new instance by a ConstructorInfo specified in the ctor parameter.
CreateInstance(Type, ReflectionWays) Creates a new instance of the specified type.
CreateInstance(Type, Object) Creates a new instance of the specified type.
CreateInstance(ConstructorInfo, ReflectionWays, Object) Creates a new instance by a ConstructorInfo specified in the ctor parameter.
CreateInstance(Type, ReflectionWays, Object) Creates a new instance of the specified type.
CreateInstance(Type, Type, ReflectionWays) Creates a new instance of the specified type.
CreateInstance(Type, Type, Object) Creates a new instance of the specified type.
CreateInstance(Type, Type, ReflectionWays, Object) Creates a new instance of the specified type.
EmptyArrayT Returns an empty array of T. The same as Array.Empty but works on every platform.
GetField(Object, FieldInfo, ReflectionWays) Gets a field represented by the specified FieldInfo.
GetField(Object, String, ReflectionWays) Gets the instance field of an object represented by the specified fieldName.
GetField(Type, String, ReflectionWays) Gets the static field of a Type represented by the specified fieldName.
GetField(Object, String, Boolean, ReflectionWays) Gets the instance field of an object represented by the specified fieldName.
GetField(Type, String, Boolean, ReflectionWays) Gets the static field of a Type represented by the specified fieldName.
GetIndexedMember(Object, Object) Gets the value of an indexable object. It can be either an array instance or an object with default members (indexed properties).
GetIndexedMember(Object, ReflectionWays, Object) Gets the value of an indexable object. It can be either an array instance or an object with default members (indexed properties).
GetProperty(Object, PropertyInfo, Object) Gets a property represented by the specified PropertyInfo.
GetProperty(Object, String, Object) Gets the instance property of an object represented by the specified propertyName.
GetProperty(Type, String, ReflectionWays) Gets the static property of a Type represented by the specified propertyName.
GetProperty(Object, PropertyInfo, ReflectionWays, Object) Gets a property represented by the specified PropertyInfo.
GetProperty(Object, String, ReflectionWays, Object) Gets the instance property of an object represented by the specified propertyName.
GetProperty(Object, String, Boolean, Object) Gets the instance property of an object represented by the specified propertyName.
GetProperty(Type, String, Boolean, ReflectionWays) Gets the static property of a Type represented by the specified propertyName.
GetProperty(Object, String, Boolean, ReflectionWays, Object) Gets the instance property of an object represented by the specified propertyName.
InvokeMethod(Object, MethodInfo, Object) Invokes a method represented by the specified MethodInfo.
InvokeMethod(Object, String, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Type, String, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Object, MethodInfo, ReflectionWays, Object) Invokes a method represented by the specified MethodInfo.
InvokeMethod(Object, MethodInfo, Type, Object) Invokes a method represented by the specified MethodInfo.
InvokeMethod(Object, String, ReflectionWays, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Object, String, Boolean, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Object, String, Type, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Type, String, ReflectionWays, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Type, String, Boolean, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Type, String, Type, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Object, MethodInfo, Type, ReflectionWays, Object) Invokes a method represented by the specified MethodInfo.
InvokeMethod(Object, String, Boolean, ReflectionWays, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Object, String, Boolean, Type, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Object, String, Type, ReflectionWays, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Type, String, Boolean, ReflectionWays, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Type, String, Boolean, Type, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Type, String, Type, ReflectionWays, Object) Invokes a static method of a Type represented by the specified methodName.
InvokeMethod(Object, String, Boolean, Type, ReflectionWays, Object) Invokes an instance method of an object represented by the specified methodName.
InvokeMethod(Type, String, Boolean, Type, ReflectionWays, Object) Invokes a static method of a Type represented by the specified methodName.
IsExplicitInterfaceImplementation(EventInfo) Determines whether the specified EventInfo is an explicit interface implementation.
IsExplicitInterfaceImplementation(MethodInfo) Determines whether the specified method is an explicit interface implementation.
IsExplicitInterfaceImplementation(PropertyInfo) Determines whether the specified property is an explicit interface implementation.
IsExplicitInterfaceImplementation(EventInfo, EventInfo) Determines whether the specified EventInfo is an explicit interface implementation.
IsExplicitInterfaceImplementation(MethodInfo, MethodInfo) Determines whether the specified method is an explicit interface implementation.
IsExplicitInterfaceImplementation(PropertyInfo, PropertyInfo) Determines whether the specified property is an explicit interface implementation.
MemberOf(ExpressionAction) Gets the action method of an expression by a refactoring-safe way.
MemberOfT(ExpressionFuncT) Gets the returned member of an expression providing a refactoring-safe way for referencing a field, property, constructor or function method.
ResolveAssembly(AssemblyName, ResolveAssemblyOptions) Gets the Assembly with the specified assemblyName.
ResolveAssembly(AssemblyNameInfo, ResolveAssemblyOptions) Gets the Assembly with the specified assemblyName.
ResolveAssembly(String, ResolveAssemblyOptions) Gets the Assembly with the specified assemblyName.
ResolveAssembly(String, Boolean, Boolean) Gets the Assembly with the specified assemblyName.
Obsolete.
ResolveType(String, ResolveTypeOptions) Gets the Type with the specified typeName. When no assembly is defined in typeName, the type can be defined in any loaded assembly.
ResolveType(TypeName, ResolveTypeOptions) Gets the Type with the specified typeName. When no assembly is defined in typeName, the type can be defined in any loaded assembly.
ResolveType(Assembly, TypeName, ResolveTypeOptions) Gets the Type with the specified typeName from the specified assembly.
ResolveType(Assembly, String, ResolveTypeOptions) Gets the Type with the specified typeName from the specified assembly. As the type is about to be resolved from the specified assembly, assembly names are allowed to be specified in the generic arguments only.
See the Examples section of the ResolveType(String, ResolveTypeOptions) overload for some examples.
ResolveType(String, Boolean, Boolean) Gets the Type with the specified typeName. When no assembly is defined in typeName, the type can be defined in any loaded assembly.
Obsolete.
ResolveType(String, FuncAssemblyName, String, Type, ResolveTypeOptions) Gets the Type with the specified typeName using the specified typeResolver.
See the Examples section of the ResolveType(String, ResolveTypeOptions) overload for details and some examples.
ResolveType(TypeName, FuncTypeName, Type, ResolveTypeOptions) Gets the Type with the specified typeName using the specified typeResolver.
SetField(Object, FieldInfo, Object, ReflectionWays) Sets a field represented by the specified FieldInfo.
SetField(Object, String, Object, ReflectionWays) Sets the instance field of an object represented by the specified fieldName.
SetField(Type, String, Object, ReflectionWays) Sets the static field of a Type represented by the specified fieldName.
SetField(Object, String, Boolean, Object, ReflectionWays) Sets the instance field of an object represented by the specified fieldName.
SetField(Type, String, Boolean, Object, ReflectionWays) Sets the static field of a Type represented by the specified fieldName.
SetIndexedMember(Object, Object, Object) Sets the value of an indexable object. It can be either an array instance or an object with default members (indexed properties).
SetIndexedMember(Object, Object, ReflectionWays, Object) Sets the value of an indexable object. It can be either an array instance or an object with default members (indexed properties).
SetProperty(Object, PropertyInfo, Object, Object) Sets a property represented by the specified PropertyInfo.
SetProperty(Object, String, Object, Object) Sets the instance property of an object represented by the specified propertyName.
SetProperty(Type, String, Object, ReflectionWays) Sets the static property of a Type represented by the specified propertyName.
SetProperty(Object, PropertyInfo, Object, ReflectionWays, Object) Sets a property represented by the specified PropertyInfo.
SetProperty(Object, String, Boolean, Object, Object) Sets the instance property of an object represented by the specified propertyName.
SetProperty(Object, String, Object, ReflectionWays, Object) Sets the instance property of an object represented by the specified propertyName.
SetProperty(Type, String, Boolean, Object, ReflectionWays) Sets the static property of a Type represented by the specified propertyName.
SetProperty(Object, String, Boolean, Object, ReflectionWays, Object) Sets the instance property of an object represented by the specified propertyName.
TryCreateInstance(Type, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, ReflectionWays, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, Object, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, Type, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, ReflectionWays, Object, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, Type, ReflectionWays, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, Type, Object, Object) Tries to create a new instance of the specified type.
TryCreateInstance(Type, Type, ReflectionWays, Object, Object) Tries to create a new instance of the specified type.
TryGetField(Object, String, Object, ReflectionWays) Tries to get the instance field of an object represented by the specified fieldName.
TryGetField(Type, String, Object, ReflectionWays) Tries to get the static field of a Type represented by the specified fieldName.
TryGetField(Object, String, Boolean, Object, ReflectionWays) Tries to get the instance field of an object represented by the specified fieldName.
TryGetField(Type, String, Boolean, Object, ReflectionWays) Tries to get the static field of a Type represented by the specified fieldName.
TryGetIndexedMember(Object, Object, Object) Tries to get the value of an indexable object. It can be either an array or an object with default members (indexed properties).
TryGetIndexedMember(Object, ReflectionWays, Object, Object) Tries to get the value of an indexable object. It can be either an array or an object with default members (indexed properties).
TryGetProperty(Object, String, Object, Object) Tries to get the instance property of an object represented by the specified propertyName.
TryGetProperty(Type, String, Object, ReflectionWays) Tries to get the static property of a Type represented by the specified propertyName.
TryGetProperty(Object, String, ReflectionWays, Object, Object) Tries to get the instance property of an object represented by the specified propertyName.
TryGetProperty(Object, String, Boolean, Object, Object) Tries to get the instance property of an object represented by the specified propertyName.
TryGetProperty(Type, String, Boolean, Object, ReflectionWays) Tries to get the static property of a Type represented by the specified propertyName.
TryGetProperty(Object, String, Boolean, ReflectionWays, Object, Object) Tries to get the instance property of an object represented by the specified propertyName.
TryInvokeMethod(Object, String, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Type, String, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Object, String, ReflectionWays, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Object, String, Boolean, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Object, String, Type, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Type, String, ReflectionWays, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Type, String, Boolean, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Type, String, Type, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Object, String, Boolean, ReflectionWays, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Object, String, Boolean, Type, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Object, String, Type, ReflectionWays, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Type, String, Boolean, ReflectionWays, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Type, String, Boolean, Type, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Type, String, Type, ReflectionWays, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TryInvokeMethod(Object, String, Boolean, Type, ReflectionWays, Object, Object) Tries to invoke an instance method of an object represented by the specified methodName.
TryInvokeMethod(Type, String, Boolean, Type, ReflectionWays, Object, Object) Tries to invoke a static method of a Type represented by the specified methodName.
TrySetField(Object, String, Object, ReflectionWays) Tries to set the instance field of an object represented by the specified fieldName.
TrySetField(Type, String, Object, ReflectionWays) Tries to set the static field of a Type represented by the specified fieldName.
TrySetField(Object, String, Boolean, Object, ReflectionWays) Tries to set the instance field of an object represented by the specified fieldName.
TrySetField(Type, String, Boolean, Object, ReflectionWays) Tries to set the static field of a Type represented by the specified fieldName.
TrySetIndexedMember(Object, Object, Object) Tries to set the value of an indexable object. It can be either an array or an object with default members (indexed properties).
TrySetIndexedMember(Object, Object, ReflectionWays, Object) Tries to set the value of an indexable object. It can be either an array or an object with default members (indexed properties).
TrySetProperty(Object, String, Object, Object) Tries to set the instance property of an object represented by the specified propertyName.
TrySetProperty(Type, String, Object, ReflectionWays) Tries to set the static property of a Type represented by the specified propertyName.
TrySetProperty(Object, String, Boolean, Object, Object) Tries to set the instance property of an object represented by the specified propertyName.
TrySetProperty(Object, String, Object, ReflectionWays, Object) Tries to set the instance property of an object represented by the specified propertyName.
TrySetProperty(Type, String, Boolean, Object, ReflectionWays) Tries to set the static property of a Type represented by the specified propertyName.
TrySetProperty(Object, String, Boolean, Object, ReflectionWays, Object) Tries to set the instance property of an object represented by the specified propertyName.

See Also