using System.Collections.Generic; namespace Encompass { internal class IDManager { int nextID = 0; private Stack availableIDs = new Stack(); public int NextID() { if (availableIDs.Count > 0) { return availableIDs.Pop(); } else { return nextID++; } } public void Free(int ID) { availableIDs.Push(ID); } } }