[英]LINQ for this foreach
I suspect there is LINQ for this but I cannot figure it out 我怀疑有LINQ,但我无法弄清楚
selectedKeys is a HashSet selectedKeys是一个HashSet
public IEnumerable<FTSword7bitThesaurus> FTSwordsPlusSelected
{
get
{
foreach (FTSword7bit w in FTSWords7bit)
{
yield return new FTSword7bitThesaurus(this, w, selectedKeys.Contains(w.Key));
}
Debug.Write("Done FTSthersarus FTSwordsPlusSelected");
}
}
How linq does it need to be? linq需要如何?
get
{
var result = FTSWords7bit
.Select(x => new FTSword7bitThesaurus(this, x, selectedKeys.Contains(x.Key));
Debug.Write("Done FTSthersarus FTSwordsPlusSelected");
return result;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.