/// <summary>Gets method information by using the method's internal metadata representation (handle).</summary> /// <returns>A MethodBase containing information about the method.</returns> /// <param name="handle">The method's handle. </param> /// <exception cref="T:System.ArgumentException"> /// <paramref name="handle" /> is invalid.</exception> public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { MethodBase methodFromIntPtr = MethodBase.GetMethodFromIntPtr(handle.Value, IntPtr.Zero); Type declaringType = methodFromIntPtr.DeclaringType; if (declaringType.IsGenericType || declaringType.IsGenericTypeDefinition) { throw new ArgumentException("Cannot resolve method because it's declared in a generic class."); } return(methodFromIntPtr); }
internal static MethodBase GetMethodFromHandleNoGenericCheck(RuntimeMethodHandle handle) { return(MethodBase.GetMethodFromIntPtr(handle.Value, IntPtr.Zero)); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { return(MethodBase.GetMethodFromIntPtr(handle.Value, declaringType.Value)); }