Dictionary<TKey, TValue>怎么定义字典,可以保存不同类型,比如保存数组,或者保存字典
BBTrade.Areas.IOS.Models.DoHandle<string,object> doHandle = new BBTrade.Areas.IOS.Models.DoHandle<string,object>();
Guid gtraderId = Guid.Empty;
doHandle = IsLogin<string,object>(traderId, token, out gtraderId);
if (!doHandle.Result) return Json(doHandle);
List<AccountData> accDataLst = new List<AccountData>();
var currencys = new CurrencyModelService().GetAll();
foreach (var item in currencys)
{
var traderWalletService = new TraderWalletModelService();
var traderWallet = traderWalletService.SingleOrDefualtNoLock(f=>f.CurrencyCode==item.CurrencyCode&&f.TraderId== gtraderId);
AccountData acc = new AccountData();
acc.CurrencyCode = item.CurrencyCode;
acc.CurrencyCount = traderWallet.CurrencyCount;
acc.FrozenCurrencyCount = traderWallet.FrozenCurrencyCount;
accDataLst.Add(acc);
}
doHandle.Result = true;
doHandle.Data.Add("accDataLst", accDataLst);
return Json(doHandle);
doHandle.Data是一个Dinctionary<string,object>。但获取不到值
不是还有个hashTable吗
Dictionary<TKey, dynamic>就可以啦。。谢谢关注
定义成Dictionary<TKey, dynamic>,就可以保存任何类型