fruit
如果谓词条件为真,如果返回参数(我知道是输入参数),我会感到困惑。正如以下代码所示:
List<string> fruits = new List<string> {
"apple",
"passionfruit",
"banana",
"mango",
"orange",
"blueberry",
"grape",
"strawberry"
};
IEnumerable<string> query = fruits.Where(fruit => fruit.Length < 8);
// query contains: {apple,banana,mango,orange,grape}
IEnumerable<string> query2 = query.Where(fruit => fruits.Contains("apple"));
foreach (string fruity in query2)
{
Console.WriteLine(fruity);
}
// finally returns: {apple,banana,mango,orange,grape}
因此,如果条件为真,就好像返回了输入。
如果我错了,请指导我