Example #1
0
        private static MethodInfo GetMatchingMethodAux(Type targetType, IPersistentVector args, string methodName, bool getStatics)
        {
            MethodInfo method = null;

            List <MethodInfo> methods = HostExpr.GetMethods(targetType, args.count(), methodName, getStatics);

            if (methods.Count == 0)
            {
                method = null;
            }
            else
            {
                int index = 0;
                if (methods.Count > 1)
                {
                    List <ParameterInfo[]> parms = new List <ParameterInfo[]>(methods.Count);
                    List <Type>            rets  = new List <Type>(methods.Count);

                    foreach (MethodInfo mi in methods)
                    {
                        parms.Add(mi.GetParameters());
                        rets.Add(mi.ReturnType);
                    }
                    index = GetMatchingParams(methodName, parms, args, rets);
                }
                method = (index >= 0 ? methods[index] : null);
            }

            return(method);
        }