Example #1
0
 /// <inheritdoc />
 public virtual void ReturnObject(TPooledObject objectToRelease)
 {
     if (UsedObjectStore.Contains(objectToRelease))
     {
         UsedObjectStore.Remove(objectToRelease);
         UnusedObjectStore.Add(objectToRelease);
     }
 }
Example #2
0
        /// <inheritdoc />
        public virtual TPooledObject GetObject()
        {
            EnsureCapacity(1);
            TPooledObject newPooledObject = UnusedObjectStore.Pop();

            if (newPooledObject != null)
            {
                UsedObjectStore.Add(newPooledObject);
            }

            return(newPooledObject);
        }