Ejemplo n.º 1
0
 public bool TryRemoveAlice(Guid uniqueId)
 {
     lock (_aliceLock)
     {
         Alice alice = Alices.FirstOrDefault(x => x.UniqueId == uniqueId);
         return(Alices.TryRemove(alice));
     }
 }
Ejemplo n.º 2
0
        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);
            }
        }