哪里
返回指定谓词为 true 的项的子集。
List<string> trees = new List<string>{ "Oak", "Birch", "Beech", "Elm", "Hazel", "Maple" };
方法语法
// Select all trees with name of length 3
var shortTrees = trees.Where(tree => tree.Length == 3); // Oak, Elm
查询语法
var shortTrees = from tree in trees
where tree.Length == 3
select tree; // Oak, Elm