Selects a member from a list of candidates, and performs type conversion from actual argument type to formal argument type.
More...
Inherited by System.DefaultBinder.
|
abstract MethodBase | BindToMethod (BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state) |
| Selects a method to invoke from the given set of methods, based on the supplied arguments. More...
|
|
abstract FieldInfo | BindToField (BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) |
| Selects a field from the given set of fields, based on the specified criteria. More...
|
|
abstract MethodBase | SelectMethod (BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers) |
| Selects a method from the given set of methods, based on the argument type. More...
|
|
abstract PropertyInfo | SelectProperty (BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers) |
| Selects a property from the given set of properties, based on the specified criteria. More...
|
|
abstract object | ChangeType (object value, Type type, CultureInfo culture) |
| Changes the type of the given Object to the given Type . More...
|
|
abstract void | ReorderArgumentArray (ref object[] args, object state) |
| Upon returning from M:System.Reflection.Binder.BindToMethod(System.Reflection.BindingFlags,System.Reflection.MethodBase[],System.Object[]@,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],System.Object@), restores the args argument to what it was when it came from BindToMethod . More...
|
|
Selects a member from a list of candidates, and performs type conversion from actual argument type to formal argument type.
Definition at line 10 of file Binder.cs.
◆ BindToField()
Selects a field from the given set of fields, based on the specified criteria.
- Parameters
-
bindingAttr | A bitwise combination of T:System.Reflection.BindingFlags values. |
match | The set of fields that are candidates for matching. For example, when a T:System.Reflection.Binder object is used by Overload:System.Type.InvokeMember, this parameter specifies the set of fields that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by P:System.Type.DefaultBinder changes the order of this array. |
value | The field value used to locate a matching field. |
culture | An instance of T:System.Globalization.CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is null , the T:System.Globalization.CultureInfo for the current thread is used.Note For example, if a binder implementation allows coercion of string values to numeric types, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. The default binder does not do such string coercions. |
- Returns
- The matching field.
- Exceptions
-
T:System.Reflection.AmbiguousMatchException | For the default binder, bindingAttr includes F:System.Reflection.BindingFlags.SetField, and match contains multiple fields that are equally good matches for value . For example, value contains a MyClass object that implements the IMyClass interface, and match contains a field of type MyClass and a field of type IMyClass. |
T:System.MissingFieldException | For the default binder, bindingAttr includes F:System.Reflection.BindingFlags.SetField, and match contains no fields that can accept value . |
T:System.NullReferenceException | For the default binder, bindingAttr includes F:System.Reflection.BindingFlags.SetField, and match is null or an empty array.-or- bindingAttr includes F:System.Reflection.BindingFlags.SetField, and value is null . |
◆ BindToMethod()
Selects a method to invoke from the given set of methods, based on the supplied arguments.
- Parameters
-
bindingAttr | A bitwise combination of T:System.Reflection.BindingFlags values. |
match | The set of methods that are candidates for matching. For example, when a T:System.Reflection.Binder object is used by Overload:System.Type.InvokeMember, this parameter specifies the set of methods that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by P:System.Type.DefaultBinder changes the order of this array. |
args | The arguments that are passed in. The binder can change the order of the arguments in this array; for example, the default binder changes the order of arguments if the names parameter is used to specify an order other than positional order. If a binder implementation coerces argument types, the types and values of the arguments can be changed as well. |
modifiers | An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified. The default binder implementation does not use this parameter. |
culture | An instance of T:System.Globalization.CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is null , the T:System.Globalization.CultureInfo for the current thread is used. Note For example, if a binder implementation allows coercion of string values to numeric types, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. The default binder does not do such string coercions. |
names | The parameter names, if parameter names are to be considered when matching, or null if arguments are to be treated as purely positional. For example, parameter names must be used if arguments are not supplied in positional order. |
state | After the method returns, state contains a binder-provided object that keeps track of argument reordering. The binder creates this object, and the binder is the sole consumer of this object. If state is not null when BindToMethod returns, you must pass state to the M:System.Reflection.Binder.ReorderArgumentArray(System.Object[]@,System.Object) method if you want to restore args to its original order, for example, so that you can retrieve the values of ref parameters (ByRef parameters in Visual Basic). |
- Returns
- The matching method.
- Exceptions
-
T:System.Reflection.AmbiguousMatchException | For the default binder, match contains multiple methods that are equally good matches for args . For example, args contains a MyClass object that implements the IMyClass interface, and match contains a method that takes MyClass and a method that takes IMyClass. |
T:System.MissingMethodException | For the default binder, match contains no methods that can accept the arguments supplied in args . |
T:System.ArgumentException | For the default binder, match is null or an empty array. |
◆ ChangeType()
abstract object System.Reflection.Binder.ChangeType |
( |
object |
value, |
|
|
Type |
type, |
|
|
CultureInfo |
culture |
|
) |
| |
|
pure virtual |
Changes the type of the given Object
to the given Type
.
- Parameters
-
value | The object to change into a new Type . |
type | The new Type that value will become. |
culture | An instance of T:System.Globalization.CultureInfo that is used to control the coercion of data types. If culture is null , the T:System.Globalization.CultureInfo for the current thread is used.Note For example, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. |
- Returns
- An object that contains the given value as the new type.
◆ ReorderArgumentArray()
abstract void System.Reflection.Binder.ReorderArgumentArray |
( |
ref object [] |
args, |
|
|
object |
state |
|
) |
| |
|
pure virtual |
Upon returning from M:System.Reflection.Binder.BindToMethod(System.Reflection.BindingFlags,System.Reflection.MethodBase[],System.Object[]@,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],System.Object@), restores the args argument to what it was when it came from BindToMethod
.
- Parameters
-
args | The actual arguments that are passed in. Both the types and values of the arguments can be changed. |
state | A binder-provided object that keeps track of argument reordering. |
◆ SelectMethod()
Selects a method from the given set of methods, based on the argument type.
- Parameters
-
bindingAttr | A bitwise combination of T:System.Reflection.BindingFlags values. |
match | The set of methods that are candidates for matching. For example, when a T:System.Reflection.Binder object is used by Overload:System.Type.InvokeMember, this parameter specifies the set of methods that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by P:System.Type.DefaultBinder changes the order of this array. |
types | The parameter types used to locate a matching method. |
modifiers | An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified. |
- Returns
- The matching method, if found; otherwise,
null
.
- Exceptions
-
T:System.Reflection.AmbiguousMatchException | For the default binder, match contains multiple methods that are equally good matches for the parameter types described by types . For example, the array in types contains a T:System.Type object for MyClass and the array in match contains a method that takes a base class of MyClass and a method that takes an interface that MyClass implements. |
T:System.ArgumentException | For the default binder, match is null or an empty array.-or-An element of types derives from T:System.Type, but is not of type RuntimeType . |
◆ SelectProperty()
Selects a property from the given set of properties, based on the specified criteria.
- Parameters
-
bindingAttr | A bitwise combination of T:System.Reflection.BindingFlags values. |
match | The set of properties that are candidates for matching. For example, when a T:System.Reflection.Binder object is used by Overload:System.Type.InvokeMember, this parameter specifies the set of properties that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by P:System.Type.DefaultBinder changes the order of this array. |
returnType | The return value the matching property must have. |
indexes | The index types of the property being searched for. Used for index properties such as the indexer for a class. |
modifiers | An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified. |
- Returns
- The matching property.
- Exceptions
-
T:System.Reflection.AmbiguousMatchException | For the default binder, match contains multiple properties that are equally good matches for returnType and indexes . |
T:System.ArgumentException | For the default binder, match is null or an empty array. |
The documentation for this class was generated from the following file: