Spot the bug in stock cleanup

from Collections
C# 14 / .NET 10 beginner 4 min 1 issue to find

Find the collection bug in this stock cleanup.

csharp
using System.Collections.Generic;

var stock = new List<int> { 4, 0, 7, 0 };

foreach (int quantity in stock)
{
    if (quantity == 0)
    {
        stock.Remove(quantity);
    }
}
Open in playground
Report an error