feat: l geminada working

This commit is contained in:
Gerard Gascón 2024-04-14 23:15:50 +02:00
parent 1869a92580
commit 30ca50fb35
15 changed files with 189 additions and 29 deletions

View file

@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Linq;
namespace Extensions {
public class LimitedSizeList<T> {
public readonly List<T> List;
private readonly int _maxSize;
public LimitedSizeList(int maxSize) {
_maxSize = maxSize;
List = new List<T>(maxSize);
}
public void Add(T item) {
List.Add(item);
if (List.Count > _maxSize) {
List.RemoveAt(0);
}
}
}
}