![](/img/trans.png)
[英]How to create dynamic Multiple And linq conditions in foreach loop
[英]Conditions on foreach loop using Linq
我有一个List<KeyValuePair<string, Records> mylist;
我想在列表中循环查看每个不同的键值。 就像是
foreach(var item in myList.select(/\*query the disctinct values of key here ?*/)
可能吗 ? 怎么样 ?
你可以做
foreach(var item in myList.Select(x => x.Key).Distinct())
{
//Your Logic
}
myList.Select(x => x.Key).Distinct()
将为您提供不同的键,并且foreach
将遍历它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.