Пример #1
0
        private IMethod ResolveInstance(IMethod method)
        {
            if (method.IsGeneric)
            {
                var declType = GenericType.Resolve(DeclaringType, this, method.DeclaringType);
                return(GenericType.CreateMethodInstance(declType, method, GenericArguments));
            }

            throw new InvalidOperationException();
        }
Пример #2
0
 public static IMethod ResolveGenericInstance(this IMethod method, IType type, IMethod context)
 {
     if (method.IsGeneric)
     {
         if (!context.IsGenericInstance)
         {
             throw new InvalidOperationException("invalid context");
         }
         method = GenericType.CreateMethodInstance(type, method, context.GenericArguments);
     }
     return(method);
 }
Пример #3
0
 public static IMethod FindOverrideMethod(this IType type, IMethod method)
 {
     if (method.IsGenericInstance)
     {
         var gm = method.InstanceOf;
         var m  = type.FindSameMethod(gm, false);
         if (m == null)
         {
             return(null);
         }
         m = GenericType.CreateMethodInstance(type, m, method.GenericArguments);
         if (m == null)
         {
             throw new InvalidOperationException();
         }
         return(m);
     }
     return(type.FindSameMethod(method, false));
 }