Esempio n. 1
0
        /// <summary>
        /// Get cached type.
        /// </summary>
        /// <param name="type">Type to get/set properties in</param>
        /// <returns>Type to use</returns>
        public static ICachedType Get(Type type)
        {
            CachedType cachedType;
            if (_types.TryGetValue(type, out cachedType))
                return cachedType;

            lock (_types)
            {
                if (_types.TryGetValue(type, out cachedType))
                    return cachedType;

                cachedType = new CachedType(type, _emitReflector);
                _types[type] = cachedType;
                return cachedType;
            }
        }
        /// <summary>
        /// Get cached type.
        /// </summary>
        /// <param name="type">Type to get/set properties in</param>
        /// <returns>Type to use</returns>
        public static ICachedType Get(Type type)
        {
            CachedType cachedType;

            if (_types.TryGetValue(type, out cachedType))
            {
                return(cachedType);
            }

            lock (_types)
            {
                if (_types.TryGetValue(type, out cachedType))
                {
                    return(cachedType);
                }

                cachedType   = new CachedType(type, _emitReflector);
                _types[type] = cachedType;
                return(cachedType);
            }
        }