Partager via


Binder.SelectMethod Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public MustOverride Function SelectMethod ( _
    bindingAttr As BindingFlags, _
    match As MethodBase(), _
    types As Type(), _
    modifiers As ParameterModifier() _
) As MethodBase
public abstract MethodBase SelectMethod(
    BindingFlags bindingAttr,
    MethodBase[] match,
    Type[] types,
    ParameterModifier[] modifiers
)

Parameters

  • match
    Type: array<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: array<System.Type[]
    The parameter types used to locate a matching method.
  • modifiers
    Type: array<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, nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
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 nulla null reference (Nothing in Visual Basic) or an empty array.

-or-

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

Remarks

This method should return nulla null reference (Nothing in Visual Basic) if no method matches the criteria. This method controls the selection provided by the GetConstructor and GetMethod methods on Type.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.