SelectMethod Method
Collapse the table of content
Expand the table of content

Binder.SelectMethod Method

Selects a method from the given set of methods, based on the argument type.

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

public abstract MethodBase SelectMethod(
	BindingFlags bindingAttr,
	MethodBase[] match,
	Type[] types,
	ParameterModifier[] modifiers
)

Parameters

bindingAttr
Type: System.Reflection.BindingFlags

A bitwise combination of BindingFlags values.

match
Type: System.Reflection.MethodBase[]

The set of methods that are candidates for matching. For example, when a Binder object is used by 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 Type.DefaultBinder changes the order of this array.

types
Type: System.Type[]

The parameter types used to locate a matching method.

modifiers
Type: System.Reflection.ParameterModifier[]

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

Return Value

Type: System.Reflection.MethodBase
The matching method, if found; otherwise, null.

ExceptionCondition
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 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.

ArgumentException

For the default binder, match is null or an empty array.

-or-

An element of types derives from Type, but is not of type RuntimeType.

This method should return null if no method matches the criteria. This method controls the selection provided by the GetConstructor and GetMethod methods on Type.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2016 Microsoft