共用方式為


IReflect.GetMethod Method (String, BindingFlags)

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

Retrieves a MethodInfo object that corresponds to a specified method under specified search constraints.

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

Syntax

'Declaration
Function GetMethod ( _
    name As String, _
    bindingAttr As BindingFlags _
) As MethodInfo
MethodInfo GetMethod(
    string name,
    BindingFlags bindingAttr
)

Parameters

Return Value

Type: System.Reflection.MethodInfo
A MethodInfo object containing the method information, with the match being based on the method name and search constraints specified in bindingAttr.

Exceptions

Exception Condition
AmbiguousMatchException

The object implements multiple methods with the same name.

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.