Ejemplo n.º 1
0
 internal bool Remove <V>(UserDataSlot <V> slot)
 {
     using (synchronizer.AcquireWriteLock())
     {
         return(slot.RemoveUserData(this));
     }
 }
Ejemplo n.º 2
0
 internal bool Remove <V>(UserDataSlot <V> slot, out V userData)
 {
     //fast path if user data doesn't exist
     using (synchronizer.AcquireReadLock())
     {
         if (!slot.Contains(this))
         {
             userData = default;
             return(false);
         }
     }
     //non-fast path, user data exists, so remove it
     using (synchronizer.AcquireWriteLock())
     {
         userData = slot.GetUserData(this, default);
         return(slot.RemoveUserData(this));
     }
 }