/// <summary> /// This method is not supported and throws <see cref="NotSupportedException"/>. /// </summary> /// <param name="item"></param> /// <returns></returns> /// <exception cref="NotSupportedException"/> public bool TryDequeue(out T item) { if (_inbox != null) { return(_inbox.TryDequeue(out item)); } item = default(T); return(false); }
/// <summary> /// Try to get an item from the queue. /// </summary> /// <param name="item">Storage location for the item to be removed.</param> /// <returns><see langword="True"/> if the dequeue succeeded.</returns> public bool TryDequeue(out T item) { if (_pending.TryDequeue(out item)) { Interlocked.Decrement(ref _count); return(true); } return(false); }