【发布时间】:2016-04-25 22:43:15
【问题描述】:
这是
foreach (KeyValuePair<string, int> kvp in myDic.Select(x => x).ToList())
{
}
还有这个
foreach (KeyValuePair<string, int> kvp in myDic.ToList())
{
}
一样吗?
我看到了这段代码,很困惑。 “Select(x => x) 部分是否只是为了方便起见,以便以后可以变成 (x => x != 0) 之类的东西?
【问题讨论】:
-
这是什么语言?请编辑问题以将语言添加为标签。
标签: c# linq loops dictionary key-value