示例#1
0
        //---------------------------------------------------------------------
        public T GetData <T>(int id) where T : EbData
        {
            string key = typeof(T).Name;
            Dictionary <int, EbData> map_data = null;

            MapData.TryGetValue(key, out map_data);
            if (map_data == null)
            {
                throw new Exception();
            }

            EbData data = null;

            map_data.TryGetValue(id, out data);
            if (data == null)
            {
                return(default(T));
            }
            else
            {
                return((T)data);
            }
        }
示例#2
0
        //---------------------------------------------------------------------
        public T getData <T>(int id) where T : EbData
        {
            string key = typeof(T).Name;
            Dictionary <int, EbData> map_data = null;

            MapData.TryGetValue(key, out map_data);
            if (map_data == null)
            {
                EbLog.Error("EbDataMgr.getData() Error, can't found EbData Type=" + key);
                return(default(T));
            }

            EbData data = null;

            map_data.TryGetValue(id, out data);
            if (data == null)
            {
                return(default(T));
            }
            else
            {
                return((T)data);
            }
        }