using System.Collections.Generic; var stock = new List<int> { 4, 0, 7, 0 }; foreach (int quantity in stock) { if (quantity == 0) { stock.Remove(quantity); } }