namespace HellionChat.Util; internal class Lender { private readonly Func Ctor; private readonly List Items = []; private int Counter; internal Lender(Func ctor) { Ctor = ctor; } internal void ResetCounter() { Counter = 0; } internal T Borrow() { if (Items.Count <= Counter) Items.Add(Ctor()); return Items[Counter++]; } }