Interface IReflectionInvocationProvider
Interface representing a reflection provider used to invoke reflection objects.
Namespace: System.Reflection
Assembly: Nuqleon.Reflection.Virtualization.dll
Syntax
public interface IReflectionInvocationProvider
Methods
AddEventHandler(EventInfo, Object, Delegate)
Adds an event handler to an event source.
Declaration
void AddEventHandler(EventInfo event, object target, Delegate handler)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.EventInfo | event | The event to add a handler to. |
System.Object | target | The event source. |
System.Delegate | handler | Encapsulates a method or methods to be invoked when the event is raised by the target. |
CreateDelegate(MethodInfo, Type)
Creates a delegate that can be used to invoke the specified static method.
Declaration
Delegate CreateDelegate(MethodInfo method, Type delegateType)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | The method to create a delegate for. |
System.Type | delegateType | The type of the delegate to create. |
Returns
Type | Description |
---|---|
System.Delegate | An instance of the specified delegate type that can be used to invoke the specified static method. |
CreateDelegate(MethodInfo, Type, Object)
Creates a delegate that can be used to invoke the specified instance method on the specified target object.
Declaration
Delegate CreateDelegate(MethodInfo method, Type delegateType, object target)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | The method to create a delegate for. |
System.Type | delegateType | The type of the delegate to create. |
System.Object | target | The target object to invoke the method on. |
Returns
Type | Description |
---|---|
System.Delegate | An instance of the specified delegate type that can be used to invoke the specified instance method on the specified target object. |
CreateInstance(Assembly, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[])
Locates the specified type from specified assembly
and creates an instance of it using the system activator, with optional case-sensitive search and having the specified culture, arguments, and binding and activation attributes.
Declaration
object CreateInstance(Assembly assembly, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Parameters
Type | Name | Description |
---|---|---|
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. |
System.Reflection.BindingFlags | bindingAttr | A bitmask that affects the way in which the search is conducted. The value is a combination of bit flags from System.Reflection.BindingFlags. |
System.Reflection.Binder | binder | An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If |
System.Object[] | args | An array that contains the arguments to be passed to the constructor. This array of arguments must match in number, order, and type the parameters of the constructor to be invoked. If the default constructor is desired, |
System.Globalization.CultureInfo | culture | An instance of CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used. (This is necessary to convert a String that represents 1000 to a Double value, for example, since 1000 is represented differently by different cultures.) |
System.Object[] | activationAttributes | An array of one or more attributes that can participate in activation. Typically, an array that contains a single |
Returns
Type | Description |
---|---|
System.Object | An instance of the specified type, or null if |
GetConstantValue(PropertyInfo)
Returns a literal value associated with the property by a compiler.
Declaration
object GetConstantValue(PropertyInfo property)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | property | The property for which to get the literal value. |
Returns
Type | Description |
---|---|
System.Object | An object that contains the literal value associated with the property. If the literal value is a class type with an element value of zero, the return value is null. |
GetDefaultValue(ParameterInfo)
Gets a value indicating the default value if the parameter has a default value.
Declaration
object GetDefaultValue(ParameterInfo parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.ParameterInfo | parameter | The parameter to get the default value for. |
Returns
Type | Description |
---|---|
System.Object | The default value of the parameter, or System.DBNull.Value if the parameter has no default value. |
GetRawConstantValue(FieldInfo)
Returns a literal value associated with the field by a compiler.
Declaration
object GetRawConstantValue(FieldInfo field)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.FieldInfo | field | The field for which to get the literal value. |
Returns
Type | Description |
---|---|
System.Object | An object that contains the literal value associated with the field. If the literal value is a class type with an element value of zero, the return value is null. |
GetRawConstantValue(PropertyInfo)
Returns a literal value associated with the property by a compiler.
Declaration
object GetRawConstantValue(PropertyInfo property)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | property | The property for which to get the literal value. |
Returns
Type | Description |
---|---|
System.Object | An object that contains the literal value associated with the property. If the literal value is a class type with an element value of zero, the return value is null. |
GetRawDefaultValue(ParameterInfo)
Gets a value indicating the default value if the parameter has a default value.
Declaration
object GetRawDefaultValue(ParameterInfo parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.ParameterInfo | parameter | The parameter to get the default value for. |
Returns
Type | Description |
---|---|
System.Object | The default value of the parameter, or System.DBNull.Value if the parameter has no default value. |
GetValue(FieldInfo, Object)
Gets the value of a field.
Declaration
object GetValue(FieldInfo field, object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.FieldInfo | field | The field to get the value from. |
System.Object | obj | The object whose field value will be retrieved, or null for a static field. |
Returns
Type | Description |
---|---|
System.Object | The value of the field. |
GetValue(PropertyInfo, Object, BindingFlags, Binder, Object[], CultureInfo)
Returns the property value of a specified object that has the specified binding, index, and culture-specific information.
Declaration
object GetValue(PropertyInfo property, object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.PropertyInfo | property | The property for which to get the value. |
System.Object | obj | The object whose property value will be returned. |
System.Reflection.BindingFlags | invokeAttr | A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, and SetProperty. You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. |
System.Reflection.Binder | binder | A System.Reflection.Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then System.Type.DefaultBinder is used. |
System.Object[] | index | Optional index values for indexed properties. This value should be null for non-indexed properties. |
System.Globalization.CultureInfo | culture | A System.Globalization.CultureInfo used to govern the coercion of types. If this is null, the System.Globalization.CultureInfo for the current thread is used. |
Returns
Type | Description |
---|---|
System.Object | The property value of the specified object. |
Invoke(ConstructorInfo, BindingFlags, Binder, Object[], CultureInfo)
Invokes the constructor with the specified arguments, under the constraints of the specified System.Reflection.Binder.
Declaration
object Invoke(ConstructorInfo constructor, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.ConstructorInfo | constructor | The constructor to invoke. |
System.Reflection.BindingFlags | invokeAttr | One of the System.Reflection.BindingFlags values that specifies the type of binding. |
System.Reflection.Binder | binder | A System.Reflection.Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then System.Type.DefaultBinder is used. |
System.Object[] | parameters | An array of type Object used to match the number, order and type of the parameters for this constructor, under the constraints of binder. If this constructor does not require parameters, pass an array with zero elements. |
System.Globalization.CultureInfo | culture | A System.Globalization.CultureInfo used to govern the coercion of types. If this is null, the System.Globalization.CultureInfo for the current thread is used. |
Returns
Type | Description |
---|---|
System.Object | An instance of the class associated with the constructor. |
Invoke(MethodBase, Object, BindingFlags, Binder, Object[], CultureInfo)
Invokes the reflected method or constructor with the given parameters.
Declaration
object Invoke(MethodBase method, object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
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.Reflection.BindingFlags | invokeAttr | One of the System.Reflection.BindingFlags values that specifies the type of binding. |
System.Reflection.Binder | binder | A System.Reflection.Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then System.Type.DefaultBinder is used. |
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. |
System.Globalization.CultureInfo | culture | A System.Globalization.CultureInfo used to govern the coercion of types. If this is null, the System.Globalization.CultureInfo for the current thread is used. |
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(Type, String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])
Invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers and culture.
Declaration
object InvokeMember(Type type, string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
Parameters
Type | Name | Description |
---|---|---|
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.Reflection.ParameterModifier[] | modifiers | An array of System.Reflection.ParameterModifier objects representing the attributes associated with the corresponding element in the args array. A parameter's associated attributes are stored in the member's signature. The default binder processes this parameter only when calling a COM component. |
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. |
System.String[] | namedParameters | An array containing the names of the parameters to which the values in the args array are passed. |
Returns
Type | Description |
---|---|
System.Object | An object representing the return value of the invoked member. |
RemoveEventHandler(EventInfo, Object, Delegate)
Removes an event handler from an event source.
Declaration
void RemoveEventHandler(EventInfo event, object target, Delegate handler)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.EventInfo | event | The event to remove a handler from. |
System.Object | target | The event source. |
System.Delegate | handler | The delegate to be disassociated from the events raised by target. |
SetValue(FieldInfo, Object, Object, BindingFlags, Binder, CultureInfo)
Sets the value of a field.
Declaration
void SetValue(FieldInfo field, object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
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. |
System.Reflection.BindingFlags | invokeAttr | One of the System.Reflection.BindingFlags values that specifies the type of binding. |
System.Reflection.Binder | binder | A System.Reflection.Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then System.Type.DefaultBinder is used. |
System.Globalization.CultureInfo | culture | A System.Globalization.CultureInfo used to govern the coercion of types. If this is null, the System.Globalization.CultureInfo for the current thread is used. |
SetValue(PropertyInfo, Object, Object, BindingFlags, Binder, Object[], CultureInfo)
Sets the property value for a specified object that has the specified binding, index, and culture-specific information.
Declaration
void SetValue(PropertyInfo property, object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
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.Reflection.BindingFlags | invokeAttr | A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. |
System.Reflection.Binder | binder | A System.Reflection.Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then System.Type.DefaultBinder is used. |
System.Object[] | index | Optional index values for indexed properties. This value should be null for non-indexed properties. |
System.Globalization.CultureInfo | culture | A System.Globalization.CultureInfo used to govern the coercion of types. If this is null, the System.Globalization.CultureInfo for the current thread is used. |