📜  使用谓词 (Lambda) 过滤列表内容 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:55.842000             🧑  作者: Mango

代码示例1
using System;
using System.Collections.Generic;

var words = new List { "falcon", "wood", "tree",
    "rock", "cloud", "rain" };

Predicate hasFourChars = word => word.Length == 4;

var words2 = words.FindAll(hasFourChars);
Console.WriteLine(string.Join(',', words2));