Редактиране

Споделяне чрез


MethodBase.GetMethodFromHandle Method

Definition

Gets method information using the specified handle.

Overloads

GetMethodFromHandle(RuntimeMethodHandle)

Gets method information by using the method's internal metadata representation (handle).

GetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle)

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

GetMethodFromHandle(RuntimeMethodHandle)

Source:
MethodBase.CoreCLR.cs
Source:
MethodBase.CoreCLR.cs
Source:
MethodBase.CoreCLR.cs

Gets method information by using the method's internal metadata representation (handle).

public:
 static System::Reflection::MethodBase ^ GetMethodFromHandle(RuntimeMethodHandle handle);
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle);
public static System.Reflection.MethodBase? GetMethodFromHandle (RuntimeMethodHandle handle);
static member GetMethodFromHandle : RuntimeMethodHandle -> System.Reflection.MethodBase
Public Shared Function GetMethodFromHandle (handle As RuntimeMethodHandle) As MethodBase

Parameters

handle
RuntimeMethodHandle

The method's handle.

Returns

A MethodBase containing information about the method.

Exceptions

handle is invalid.

Remarks

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

Applies to

GetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle)

Source:
MethodBase.CoreCLR.cs
Source:
MethodBase.CoreCLR.cs
Source:
MethodBase.CoreCLR.cs

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

public:
 static System::Reflection::MethodBase ^ GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
public static System.Reflection.MethodBase? GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
[System.Runtime.InteropServices.ComVisible(false)]
public static System.Reflection.MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
static member GetMethodFromHandle : RuntimeMethodHandle * RuntimeTypeHandle -> System.Reflection.MethodBase
[<System.Runtime.InteropServices.ComVisible(false)>]
static member GetMethodFromHandle : RuntimeMethodHandle * RuntimeTypeHandle -> System.Reflection.MethodBase
Public Shared Function GetMethodFromHandle (handle As RuntimeMethodHandle, declaringType As RuntimeTypeHandle) As MethodBase

Parameters

handle
RuntimeMethodHandle

A handle to the internal metadata representation of a constructor or method.

declaringType
RuntimeTypeHandle

A handle to the generic type that defines the constructor or method.

Returns

A MethodBase object representing the method or constructor specified by handle, in the generic type specified by declaringType.

Attributes

Exceptions

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> is different from the MethodBase object for that method in the generic type definition.

Applies to