public bool TryRemoveAlice(Guid uniqueId) { lock (_aliceLock) { Alice alice = Alices.FirstOrDefault(x => x.UniqueId == uniqueId); return(Alices.TryRemove(alice)); } }
public Alice FindAlice(string uniqueId, bool throwException) { lock (_aliceLock) { Alice alice = Alices.FirstOrDefault(x => x.UniqueId == new Guid(uniqueId)); if (alice == default(Alice)) { if (throwException) { throw new ArgumentException("Wrong uniqueId"); } } return(alice); } }