using System.Collections.Generic;
public class Program
{
public static void Main()
var list = new List<int> { 1, 2, 3, 4, 5 };
foreach (var item in list)
if (item == 3)
list.Remove(3);
}