//解析数据 private static TResult CacheToMap <T, TResult>(Type type) { ByteArray byteArr; if (_rawBytesDic.TryGetValue(type, out byteArr)) { ; } { if (byteArr != null && byteArr.Length > 0) { var dataList = JSHelper.ParseProToObj(byteArr, true) as DataList; if (dataList != null) { var collection = new DataCollection <T>(dataList.items.Count); for (int i = 0; i < dataList.items.Count; i++) { T obj = (T)dataList.items[i]; int key = JSHelper.GetDataObjectKey(obj); //反射获取id collection.AddList(obj); collection.AddMap(key, obj); } _staticDataMap[type] = collection; } } _rawBytesDic.Remove(type); } return(_staticDataMap.ContainsKey(type) ? (TResult)_staticDataMap[type] : default(TResult)); }