remove all

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
					
public class Program
{
	public static void Main()
	{
		List<string> strings = new List<string>() { "A", "B", "C" };
		
		Console.WriteLine("Before:");
		foreach(string s in strings)
		{
			Console.WriteLine(s);
		}
		
		strings.RemoveAll(x => x == "B");
		
		Console.WriteLine("After:");
		foreach(string s in strings)
		{
			Console.WriteLine(s);
		}				
	}
}
;