foreach语句中的多个where子句c#

swe*_*lea 0 c# linq where

我有以下声明:

foreach (var textBlock in scoresGrid.Children.OfType<TextBlock>().Where(three => three.Name.Contains("Three")))
Run Code Online (Sandbox Code Playgroud)

我怎么能做到这样我才能做到这一点呢where name contain three or four

请帮忙.谢谢

Adi*_*dil 5

使用或||运算符组合where子句中的条件.

foreach (var textBlock in scoresGrid.Children.OfType<TextBlock>()
           .Where(three => three.Name.Contains("Three") || three.Name.Contains("Four")))
Run Code Online (Sandbox Code Playgroud)