Represents a first-in, first-out collection whose mutations are recorded in a journal.
public abstract void Clear()
Removes all elements from the queue.
public abstract bool Contains(T item)
Determines whether the queue contains the specified element.
Parameters
itemT- The element to locate in the queue.
Returns
true if the queue contains item; otherwise, false.
public abstract void CopyTo(T[] array, int arrayIndex)
Copies the queue elements to an array, starting at the specified array index.
Parameters
arrayT[]- The destination array.
arrayIndexint- The zero-based index in
array at which copying begins.
public abstract T Dequeue()
Removes and returns the element at the beginning of the queue.
Returns
The element removed from the beginning of the queue.
public abstract void Enqueue(T item)
Adds an element to the end of the queue.
Parameters
itemT- The element to add to the queue.
Returns the element at the beginning of the queue without removing it.
Returns
The element at the beginning of the queue.
public abstract bool TryDequeue(out T item)
Attempts to remove and return the element at the beginning of the queue.
Parameters
itemT- The removed element, or the default value of
T when the queue is empty.
Returns
true if an element was removed; otherwise, false.
public abstract bool TryPeek(out T item)
Attempts to return the element at the beginning of the queue without removing it.
Parameters
itemT- The element at the beginning of the queue, or the default value of
T when the queue is empty.
Returns
true if an element was returned; otherwise, false.