Show / Hide Table of Contents

Class ReflectionInvocationProviderExtensions

Provides a set of extension methods for IReflectionInvocationProvider.

Inheritance
System.Object
ReflectionInvocationProviderExtensions
Namespace: System.Reflection
Assembly: Nuqleon.Reflection.Virtualization.dll
Syntax
public static class ReflectionInvocationProviderExtensions : Object

Methods

CreateInstance(IReflectionInvocationProvider, Assembly, String)

Locates the specified type from specified assembly and creates an instance of it using the system activator, using case-sensitive search.

Declaration
public static object CreateInstance(this IReflectionInvocationProvider provider, Assembly assembly, string typeName)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.Assembly assembly

The assembly containing the type to instantiate.

System.String typeName

The System.Type.FullName of the type to locate.

Returns
Type Description
System.Object

An instance of the specified type, or null if typeName is not found. The supplied arguments are used to resolve the type, and to bind the constructor that is used to create the instance.

CreateInstance(IReflectionInvocationProvider, Assembly, String, Boolean)

Locates the specified type from specified assembly and creates an instance of it using the system activator, with optional case-sensitive search.

Declaration
public static object CreateInstance(this IReflectionInvocationProvider provider, Assembly assembly, string typeName, bool ignoreCase)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.Assembly assembly

The assembly containing the type to instantiate.

System.String typeName

The System.Type.FullName of the type to locate.

System.Boolean ignoreCase

true to ignore the case of the type name; otherwise, false.

Returns
Type Description
System.Object

An instance of the specified type, or null if typeName is not found. The supplied arguments are used to resolve the type, and to bind the constructor that is used to create the instance.

GetValue(IReflectionInvocationProvider, PropertyInfo, Object)

Returns the property value of a specified object.

Declaration
public static object GetValue(this IReflectionInvocationProvider provider, PropertyInfo property, object obj)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.PropertyInfo property

The property for which to get the value.

System.Object obj

The object whose property value will be returned.

Returns
Type Description
System.Object

The property value of the specified object.

GetValue(IReflectionInvocationProvider, PropertyInfo, Object, Object[])

Returns the property value of a specified object that has the specified index.

Declaration
public static object GetValue(this IReflectionInvocationProvider provider, PropertyInfo property, object obj, object[] index)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.PropertyInfo property

The property for which to get the value.

System.Object obj

The object whose property value will be returned.

System.Object[] index

Optional index values for indexed properties. This value should be null for non-indexed properties.

Returns
Type Description
System.Object

The property value of the specified object.

Invoke(IReflectionInvocationProvider, ConstructorInfo, Object[])

Invokes the constructor reflected by the instance that has the specified parameters, providing default values for the parameters not commonly used.

Declaration
public static object Invoke(this IReflectionInvocationProvider provider, ConstructorInfo constructor, object[] parameters)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.ConstructorInfo constructor

The constructor to invoke.

System.Object[] parameters

An array of values that matches the number, order and type (under the constraints of the default binder) of the parameters for this constructor. If this constructor takes no parameters, then use either an array with zero elements or null.

Returns
Type Description
System.Object

An instance of the class associated with the constructor.

Invoke(IReflectionInvocationProvider, MethodBase, Object, Object[])

Invokes the reflected method or constructor with the given parameters.

Declaration
public static object Invoke(this IReflectionInvocationProvider provider, MethodBase method, object obj, object[] parameters)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.MethodBase method

The method or constructor to invoke.

System.Object obj

The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be null or an instance of the class that defines the constructor.

System.Object[] parameters

An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, this should be null.

Returns
Type Description
System.Object

An object containing the return value of the invoked method, or null in the case of a constructor, or null if the method's return type is void.

InvokeMember(IReflectionInvocationProvider, Type, String, BindingFlags, Binder, Object, Object[])

Invokes the specified member, using the specified binding constraints and matching the specified argument list.

Declaration
public static object InvokeMember(this IReflectionInvocationProvider provider, Type type, string name, BindingFlags invokeAttr, Binder binder, object target, object[] args)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Type type

The type to invoke a member on.

System.String name

The string containing the name of the constructor, method, property, or field member to invoke.

System.Reflection.BindingFlags invokeAttr

A bitmask comprised of one or more System.Reflection.BindingFlags that specify how the search is conducted. The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static are used.

System.Reflection.Binder binder

An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. If binder is null, then System.Type.DefaultBinder is used.

System.Object target

The object on which to invoke the specified member.

System.Object[] args

An array containing the arguments to pass to the member to invoke.

Returns
Type Description
System.Object

An object representing the return value of the invoked member.

InvokeMember(IReflectionInvocationProvider, Type, String, BindingFlags, Binder, Object, Object[], CultureInfo)

Invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.

Declaration
public static object InvokeMember(this IReflectionInvocationProvider provider, Type type, string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, CultureInfo culture)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Type type

The type to invoke a member on.

System.String name

The string containing the name of the constructor, method, property, or field member to invoke.

System.Reflection.BindingFlags invokeAttr

A bitmask comprised of one or more System.Reflection.BindingFlags that specify how the search is conducted. The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static are used.

System.Reflection.Binder binder

An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. If binder is null, then System.Type.DefaultBinder is used.

System.Object target

The object on which to invoke the specified member.

System.Object[] args

An array containing the arguments to pass to the member to invoke.

System.Globalization.CultureInfo culture

The System.Globalization.CultureInfo object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double. If this is null, the System.Globalization.CultureInfo for the current thread is used.

Returns
Type Description
System.Object

An object representing the return value of the invoked member.

SetValue(IReflectionInvocationProvider, FieldInfo, Object, Object)

Sets the value of a field.

Declaration
public static void SetValue(this IReflectionInvocationProvider provider, FieldInfo field, object obj, object value)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.FieldInfo field

The field to set the value on.

System.Object obj

The object whose field value will be set, or null for a static field.

System.Object value

The value to assign to the field.

SetValue(IReflectionInvocationProvider, PropertyInfo, Object, Object)

Sets the property value for a specified object.

Declaration
public static void SetValue(this IReflectionInvocationProvider provider, PropertyInfo property, object obj, object value)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.PropertyInfo property

The property for which to set the value.

System.Object obj

The object whose property value will be set.

System.Object value

The new property value.

SetValue(IReflectionInvocationProvider, PropertyInfo, Object, Object, Object[])

Sets the property value for a specified object that has the specified index.

Declaration
public static void SetValue(this IReflectionInvocationProvider provider, PropertyInfo property, object obj, object value, object[] index)
Parameters
Type Name Description
IReflectionInvocationProvider provider

The reflection invocation provider.

System.Reflection.PropertyInfo property

The property for which to set the value.

System.Object obj

The object whose property value will be set.

System.Object value

The new property value.

System.Object[] index

Optional index values for indexed properties. This value should be null for non-indexed properties.

In This Article
Back to top Generated by DocFX