public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if MONO MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType(handle.Value, IntPtr.Zero); if (m == null) { throw new ArgumentException("The handle is invalid."); } #else MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo()); #endif Type declaringType = m.DeclaringType; if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), m, declaringType.GetGenericTypeDefinition())); } return(m); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(SR.Argument_InvalidHandle); } MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType(handle.Value, declaringType.Value); if (m == null) { throw new ArgumentException(SR.Argument_InvalidHandle); } return(m); }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) { if (handle.IsNullHandle()) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); } #if MONO MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType(handle.Value, declaringType.Value); if (m == null) { throw new ArgumentException("The handle is invalid."); } return(m); #else return(RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo())); #endif }
public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle) { if (handle.IsNullHandle()) { throw new ArgumentException(SR.Argument_InvalidHandle); } MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType(handle.Value, IntPtr.Zero); if (m == null) { throw new ArgumentException(SR.Argument_InvalidHandle); } Type declaringType = m.DeclaringType; if (declaringType != null && declaringType.IsGenericType) { throw new ArgumentException(string.Format(SR.Argument_MethodDeclaringTypeGeneric, m, declaringType.GetGenericTypeDefinition())); } return(m); }