MethodSpecification ImportMethodSpecification(MethodReference method, ImportGenericContext context) { if (!method.IsGenericInstance) throw new NotSupportedException(); var instance = (GenericInstanceMethod)method; var element_method = ImportMethod(instance.ElementMethod, context); var imported_instance = new GenericInstanceMethod(element_method); var arguments = instance.GenericArguments; var imported_arguments = imported_instance.GenericArguments; for (int i = 0; i < arguments.Count; i++) imported_arguments.Add(ImportType(arguments[i], context)); return imported_instance; }
MethodReference ImportMethodSpecification(SR.MethodBase method, ImportGenericContext context) { var method_info = method as SR.MethodInfo; if (method_info == null) throw new InvalidOperationException(); var element_method = ImportMethod(method_info.GetGenericMethodDefinition(), context, ImportGenericKind.Definition); var instance = new GenericInstanceMethod(element_method); var arguments = method.GetGenericArguments(); var instance_arguments = instance.GenericArguments; context.Push(element_method); try { for (int i = 0; i < arguments.Length; i++) instance_arguments.Add(ImportType(arguments[i], context)); return instance; } finally { context.Pop(); } }