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

IndexGet() публичный Метод

public IndexGet ( CLS_Content environment, object object_this, object key ) : CLS_Content.Value
environment CLS_Content
object_this object
key object
Результат CLS_Content.Value
        public virtual CLS_Content.Value IndexGet(CLS_Content environment, object object_this, object key)
        {
            //var m = type.GetMembers();
            if (indexGetCache == null)
            {
                indexGetCache = type.GetMethod("get_Item");
                if (indexGetCache != null)
                {
                    indexGetCacheType = indexGetCache.ReturnType;
                }
                //    CLS_Content.Value v = new CLS_Content.Value();
                //    v.type = targetop.ReturnType;
                //    v.value = targetop.Invoke(object_this, new object[] { key });
                //    return v;
                //}
                if (indexGetCache == null)
                {
                    indexGetCache = type.GetMethod("GetValue", new Type[] { typeof(int) });
                    if (indexGetCache != null)
                    {
                        indexGetCacheType = type.GetElementType();
                    }

                }
                indexGetCachetypeindex = indexGetCache.GetParameters()[0].ParameterType;
                //if (indexGetCache != null)
                //{
                //    CLS_Content.Value v = new CLS_Content.Value();
                //    v.type = indexGetCacheType;
                //    v.value = indexGetCache.Invoke(object_this, new object[] { key });
                //    return v;
                //}
                //{
                //    targetop = type.GetMethod("GetValue", new Type[] { typeof(int) });
                //    if (targetop != null)
                //    {
                //        //targetop = type.GetMethod("Get");

                //        CLS_Content.Value v = new CLS_Content.Value();
                //        v.type = type.GetElementType();
                //        v.value = targetop.Invoke(object_this, new object[] { key });
                //        return v;
                //    }
                //}
            }
            //else
            {
                CLS_Content.Value v = new CLS_Content.Value();
                v.type = indexGetCacheType;
                if (key != null && key.GetType() != indexGetCachetypeindex)
                    key = environment.environment.GetType(key.GetType()).ConvertTo(environment, key, (CSLE.CLType)indexGetCachetypeindex);
                v.value = indexGetCache.Invoke(object_this, new object[] { key });
                return v;
            }
            //throw new NotImplementedException();

        }