CSLE.RegHelper_TypeFunction.FindTMethod C# (CSharp) Метод

FindTMethod() приватный Метод

private FindTMethod ( Type type, string func, IList _params, Type gtypes ) : System.Reflection.MethodInfo
type System.Type
func string
_params IList
gtypes System.Type
Результат System.Reflection.MethodInfo
        System.Reflection.MethodInfo FindTMethod(Type type, string func, IList<CLS_Content.Value> _params, Type[] gtypes)
        {
            string hashkey = func + "_" + _params.Count + ":";
            foreach (var p in _params)
            {
                hashkey += p.type.ToString();
            }
            foreach (var t in gtypes)
            {
                hashkey += t.ToString();
            }
            int hashcode = hashkey.GetHashCode();
            if (cacheT != null)
            {
                if (cacheT.ContainsKey(hashcode))
                {
                    return cacheT[hashcode];
                }
            }
            //+"~" + (sf.Length - 1).ToString();
            var ms = type.GetMethods();
            foreach (var t in ms)
            {
                if (t.Name == func && t.IsGenericMethodDefinition)
                {
                    var pp = t.GetParameters();
                    if (pp.Length != _params.Count) continue;
                    bool match = true;
                    for (int i = 0; i < pp.Length; i++)
                    {
                        if (pp[i].ParameterType.IsGenericType) continue;
                        if (pp[i].ParameterType.IsGenericParameter) continue;
                        if (pp[i].ParameterType != (Type)_params[i].type)
                        {
                            match = false;
                            break;
                        }
                    }
                    if (match)
                    {
                        var targetop = t.MakeGenericMethod(gtypes);


                        if (cacheT == null)
                            cacheT = new Dictionary<int, System.Reflection.MethodInfo>();
                        cacheT[hashcode] = targetop;
                        return targetop;
                    }
                }
            }
            //targetop = type.GetMethod(tfunc, types.ToArray());
            //var pp =targetop.GetParameters();
            //targetop = targetop.MakeGenericMethod(gtypes);
            return null;
        }
        public virtual CLS_Content.Value MemberCall(CLS_Content environment, object object_this, string function, IList<CLS_Content.Value> _params)