MethodBase.GetMethodFromHandle Method (RuntimeMethodHandle, RuntimeTypeHandle)

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

Gets the constructor or method represented by the specified handle, for the specified generic type.

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

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public Shared Function GetMethodFromHandle ( _
    handle As RuntimeMethodHandle, _
    declaringType As RuntimeTypeHandle _
) As MethodBase
[ComVisibleAttribute(false)]
public static MethodBase GetMethodFromHandle(
    RuntimeMethodHandle handle,
    RuntimeTypeHandle declaringType
)

Parameters

Return Value

Type: System.Reflection.MethodBase
The method or constructor specified by handle, in the generic type specified by declaringType.

Exceptions

Exception Condition
MethodAccessException

This member is invoked late-bound through mechanisms such as Type.InvokeMember.

ArgumentException

handle is invalid.

Remarks

Handles are valid only in the application domain in which they were obtained.

A RuntimeMethodHandle structure for a constructor or method of a generic type can represent different MethodBase objects, depending on the types specified for the type parameters of the generic type. For example, if class G<T> (class G(Of T) in Visual Basic, generic <T> ref class G in C++) has a method that returns type T, the MethodBase object for that method in a constructed class such as G<int> (G(Of Integer) in Visual Basic) is different from the MethodBase object for that method in the generic type definition, the MethodBase object for G<string>, and so on.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 For the declaringType parameter, this member uses RuntimeMethodHandle instead of RuntimeTypeHandle.

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.