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);
			}
		}
	}
}