private bool UpdateCursor(string key, ulong id) { lock (_lockObj) { // O(n), but small n and it's not common var index = _cursors.FindIndex(c => c.Key == key); if (index != -1) { _cursors[index].Id = id; return true; } return false; } }