namespace Managing.Core.FixedSizedQueue;

public class FixedSizeQueue<T> : Queue<T>
{
    private readonly int _maxSize;
    public FixedSizeQueue(int maxSize) => _maxSize = maxSize;

    public new void Enqueue(T item)
    {
        while (Count >= _maxSize) Dequeue();
        base.Enqueue(item);
    }
}