コード例 #1
0
            public static RuntimeInfo Create(Type type, Dictionary <Type, RuntimeInfo> tempCache)
            {
                if (type == null)
                {
                    return(null);
                }

                if ((type.IsValueType && !type.IsGenericType) || type == typeof(string))
                {
                    tempCache[type] = null;
                    return(null);
                }

                RuntimeInfo existing = null;

                if (InternalCache.TryGet(type, out existing))
                {
                    return(existing);
                }

                if (tempCache.TryGetValue(type, out existing))
                {
                    return(existing);
                }

                RuntimeInfo runtimeInfo = null;

                tempCache[type] = runtimeInfo = new RuntimeInfo()
                {
                    _type       = type,
                    _actionInfo = GetRuntimeActionForType(type)
                };

                runtimeInfo._runtimeCollectionElementInfo = RuntimeInfo.Create(GetGenericCollectionElementType(type), tempCache);
                runtimeInfo._runtimeMembers = CreateRuntimeMemberInfo(type, tempCache).ToArray();

                return(runtimeInfo);
            }
コード例 #2
0
ファイル: Cache.cs プロジェクト: wxlevel/petstore-ddd-csharp
        public static bool TryGet <T>(string key, out T value)
        {
            Check.Argument.IsNotNullOrEmpty(key, "key");

            return(InternalCache.TryGet(key, out value));
        }