【发布时间】:2010-11-13 10:01:40
【问题描述】:
我想在下面的Dictionary中获取Lists中的项目总数:
Dictionary<int, List<string>> dd = new Dictionary<int, List<string>>() {
{1, new List<string> {"cem"}},
{2, new List<string> {"cem", "canan"}},
{3, new List<string> {"canan", "cenk", "cem"}}
};
// This only returns an enumerated array.
var i = (from c in dd
select c.Value.Count).Select(p=>p);
【问题讨论】:
-
您想要总数吗?在示例 6 的情况下?
-
是的。我想谈谈字典列表中每一项的计数。
标签: c# linq dictionary