Esempio n. 1
0
        public T[] GetAllRegisteredInfos <T>()
        {
            Type t = typeof(T);

            if (_dictSyncs.ContainsKey(t))
            {
                ParamHolder <T> holder = _dictSyncs[t] as ParamHolder <T>;
                if (!holder.HasUpdated())
                {
                    holder.Update();
                }
                return(holder.Sync.Values.ToArray());
            }
            else
            {
                throw new InvalidOperationException("尚未注册此类型的刷新服务:" + t);
            }
        }
Esempio n. 2
0
        public T GetRegisteredInfo <T>(string key)
        {
            Type t = typeof(T);

            if (_dictSyncs.ContainsKey(t))
            {
                ParamHolder <T> holder = _dictSyncs[t] as ParamHolder <T>;
                if (!holder.HasUpdated())
                {
                    holder.Update();
                }
                T value = default(T);
                holder.Sync.TryGetValue(key, out value);
                return(value);
            }
            else
            {
                throw new InvalidOperationException("尚未注册此类型的刷新服务:" + t);
            }
        }