using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(4);
list.Add(5);
// Remove all list items with value of 2.
// The lambda expression is the Predicate.
list.RemoveAll(item => item == 2);
// Display results.
foreach (int i in list)
Console.WriteLine(i);
}