예제 #1
0
        public IMethod GetMethod(string funcname, MethodParamList types)
        {
            if (funcname == ".ctor")
            {
                var con = TypeForSystem.GetConstructor(types.ToArraySystem());
                return(new Method_Common_System(this, con));
            }
            var method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, method));
        }
예제 #2
0
        public IMethod GetMethodT(string funcname, MethodParamList ttypes, MethodParamList types)
        {
            //这个实现还不完全
            //有个别重构下,判定比这个要复杂
            System.Reflection.MethodInfo _method = null;
            var ms = TypeForSystem.GetMethods();

            foreach (var m in ms)
            {
                if (m.Name == funcname && m.IsGenericMethodDefinition)
                {
                    var ts = m.GetGenericArguments();
                    var ps = m.GetParameters();
                    if (ts.Length == ttypes.Count && ps.Length == types.Count)
                    {
                        _method = m;
                        break;
                    }
                }
            }

            // _method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, _method.MakeGenericMethod(ttypes.ToArraySystem())));
        }
        public virtual IMethod GetMethod(string funcname, MethodParamList types)
        {
            bool    flag = funcname == ".ctor";
            IMethod result;

            if (flag)
            {
                ConstructorInfo constructor = this.TypeForSystem.GetConstructor(types.ToArraySystem());
                result = new Method_Common_System(this, constructor);
            }
            else
            {
                MethodInfo method = this.TypeForSystem.GetMethod(funcname, types.ToArraySystem());
                result = new Method_Common_System(this, method);
            }
            return(result);
        }
예제 #4
0
        public virtual IMethod GetMethod(string funcname, MethodParamList types)
        {
            if (funcname == ".ctor")
            {
                var con = TypeForSystem.GetConstructor(types.ToArraySystem());
                return(new Method_Common_System(this, con));
            }
            else if (funcname == "Get" && TypeForSystem == typeof(int[, ]) && types.Count == 2 && types[0].TypeForSystem == typeof(int) && types[1].TypeForSystem == typeof(int))
            {
                return(new Method_Common_System(this, typeof(CustomMethod).GetMethod("GetTwoDimesionArray")));
            }
            var method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());
            var ret    = new Method_Common_System(this, method);

            Func <object, object[], object> fastCall;

            if (FastCalls.TryGetValue(method, out fastCall))
            {
                ret.SetFastCall(fastCall);
            }

            return(ret);
        }
예제 #5
0
        public virtual IMethod GetMethodT(string funcname, MethodParamList ttypes, MethodParamList types)
        {
            if (funcname == "CompareExchange")
            {
                return(new Method_Common_System(this, typeof(CustomMethod).GetMethod("CompareExchange")));
            }

            //这个实现还不完全
            //有个别重构下,判定比这个要复杂
            System.Reflection.MethodInfo _method = null;
            var ms = TypeForSystem.GetMethods();

            {
                var __array4       = ms;
                var __arrayLength4 = __array4.Length;
                for (int __i4 = 0; __i4 < __arrayLength4; ++__i4)
                {
                    var m = __array4[__i4];
                    {
                        if (m.Name == funcname && m.IsGenericMethodDefinition)
                        {
                            var ts = m.GetGenericArguments();
                            var ps = m.GetParameters();
                            if (ts.Length == ttypes.Count && ps.Length == types.Count)
                            {
                                _method = m;
                                break;
                            }
                        }
                    }
                }
            }
            // _method = TypeForSystem.GetMethod(funcname, types.ToArraySystem());

            return(new Method_Common_System(this, _method.MakeGenericMethod(ttypes.ToArraySystem())));
        }
        public virtual IMethod GetMethodT(string funcname, MethodParamList ttypes, MethodParamList types)
        {
            MethodInfo methodInfo = null;

            MethodInfo[] methods = this.TypeForSystem.GetMethods();
            MethodInfo[] array   = methods;
            for (int i = 0; i < array.Length; i++)
            {
                MethodInfo methodInfo2 = array[i];
                bool       flag        = methodInfo2.Name == funcname && methodInfo2.IsGenericMethodDefinition;
                if (flag)
                {
                    Type[]          genericArguments = methodInfo2.GetGenericArguments();
                    ParameterInfo[] parameters       = methodInfo2.GetParameters();
                    bool            flag2            = genericArguments.Length == ttypes.Count && parameters.Length == types.Count;
                    if (flag2)
                    {
                        methodInfo = methodInfo2;
                        break;
                    }
                }
            }
            return(new Method_Common_System(this, methodInfo.MakeGenericMethod(ttypes.ToArraySystem())));
        }