public class AutoIncrementIdFactory { private uint _currentID = 0; public uint NextId() { return ++_currentID; } public uint PeekId() { return _currentID; } public void Recognize(uint existing_id) { if (_currentID < existing_id) _currentID = existing_id; } public void Reset() { _currentID = 0; } }