BindToMethod Method

Binder.BindToMethod Method

Selects a method to invoke from the given set of methods, based on the actual arguments.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public abstract MethodBase BindToMethod (
	BindingFlags bindingAttr,
	MethodBase[] match,
	ref Object[] args,
	ParameterModifier[] modifiers,
	CultureInfo culture,
	string[] names,
	out Object state
public abstract MethodBase BindToMethod (
	BindingFlags bindingAttr, 
	MethodBase[] match, 
	/** @ref */ Object[] args, 
	ParameterModifier[] modifiers, 
	CultureInfo culture, 
	String[] names, 
	/** @attribute OutAttribute() */ /** @ref */ Object state
JScript does not support passing value-type arguments by reference.



One of the BindingFlags enumerators.


The set of methods Reflection has determined to be a possible match, typically because they have the correct member name.


The actual arguments passed in. Both the types and values of the arguments can be changed.


An array of parameter modifiers that enable binding to work with parameter signatures in which the types have been modified.


An instance of CultureInfo used to control the coercion of data types. If culture is a null reference (Nothing in Visual Basic), the CultureInfo for the current thread is used.


For example, this parameter is necessary to convert a String that represents 1000 to a Double value, since 1000 is represented differently by different cultures.


The method name or names.


A binder-provided object that keeps track of argument reordering. The state parameter is a cookie that was passed to BindToMethod and represents an opaque object. The binder creates this object, and the binder is the sole consumer of this object. If state is not a null reference (Nothing in Visual Basic) when BindToMethod returns, the runtime calls ReorderArgumentArray.

Return Value

A MethodBase object containing the matching method.

The binder allows a client to map the array of arguments back to its original form if the argument array has been manipulated by BindToMethod. Use this remap capability to get back by-reference arguments when such arguments are present. However, to get back by-reference arguments, you must be able to ensure that the argument order you used has not changed. When you pass arguments by name, the binder reorders the argument array, and that is what the calling methods see. The state parameter keeps track of argument reordering, thus enabling the binder to reorder the argument array to its original form.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

© 2016 Microsoft