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

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

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

var data = new List { 1, -2, 3, 0, 2, -1 };

Predicate isPositive = delegate(int val) { return val > 0; };
var filtered = data.FindAll(isPositive);

Console.WriteLine(string.Join(",", filtered));