linq高手求解 怎么把 var query = from t in biz.biz_order_para.Where(x => listOrder_nos.Contains(x.order_ID.ToString()))
where para_keys.Contains(t.para_key)
group t by t.para_key into g
select new { v = g.Sum(s => Convert.ToInt32(s.para_value)), g.Key };
放到 Dictionary<string, string> dictionary = new Dictionary<string, string>();这个字典里面
LINQ
分享到:
------解决方案-------------------- dictionary = query.ToDictionary(g => g.Key, g => g.v); ------解决方案--------------------
var query = from t in biz.biz_order_para.Where(x => listOrder_nos.Contains(x.order_ID.ToString()))
where para_keys.Contains(t.para_key)
group t by t.para_key into g
select new { v = g.Sum(s => Convert.ToInt32(s.para_value)), g.Key };
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary =query.ToDictionary(c => c.Key, c => c.v);
------解决方案--------------------
试试这样:
var query = from t in biz.biz_order_para.Where(x => listOrder_nos.Contains(x.order_ID.ToString()))