예제 #1
0
        /// <summary>
        /// 根据类型获取成员索引分组
        /// </summary>
        /// <param name="type">对象类型</param>
        /// <returns>成员索引分组</returns>
        public static MemberIndexGroup Get(Type type)
        {
            MemberIndexGroup value;

            Monitor.Enter(cacheLock);
            try
            {
                if (!cache.TryGetValue(type, out value))
                {
                    cache.Add(type, value = new MemberIndexGroup(type, false));
                }
            }
            finally { Monitor.Exit(cacheLock); }
            return(value);
        }
예제 #2
0
        /// <summary>
        /// 根据类型获取成员索引分组
        /// </summary>
        /// <param name="type">对象类型</param>
        /// <returns>成员索引分组</returns>
        public static MemberIndexGroup Get(Type type)
        {
            MemberIndexGroup value;

            cacheLock.Enter();
            try
            {
                if (!cache.TryGetValue(type, out value))
                {
                    cacheLock.SleepFlag   = 1;
                    cache.Add(type, value = new MemberIndexGroup(type, false));
                }
            }
            finally { cacheLock.ExitSleepFlag(); }
            return(value);
        }