Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Collections.​Queue
Assembly: System.Collections.NonGeneric
Inheritance: object → Queue
Represents a first-in, first-out collection of objects.
Properties
public
int
Count
Gets the number of elements contained in the <see cref="T:System.Collections.Queue" /> .
public
bool
IsSynchronized
Gets a value indicating whether access to the <see cref="T:System.Collections.Queue" /> is synchronized (thread safe).
public
object
SyncRoot
Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.Queue" /> .
Methods
public
void
Clear​()
Removes all objects from the <see cref="T:System.Collections.Queue" /> .
public
object
Clone​() Returns A shallow copy of the <see cref="T:System.Collections.Queue" /> .
Creates a shallow copy of the <see cref="T:System.Collections.Queue" /> .
public
bool
Contains​(object obj)
obj
The <see cref="T:System.Object" /> to locate in the <see cref="T:System.Collections.Queue" /> . The value can be <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> is found in the <see cref="T:System.Collections.Queue" /> ; otherwise, <see langword="false" /> .
Determines whether an element is in the <see cref="T:System.Collections.Queue" /> .
public
void
CopyTo​(Array array,
int index)
array
The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Queue" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
index
The zero-based index in <paramref name="array" /> at which copying begins.
Copies the <see cref="T:System.Collections.Queue" /> elements to an existing one-dimensional <see cref="T:System.Array" /> , starting at the specified array index.
public
object
Dequeue​() Returns The object that is removed from the beginning of the <see cref="T:System.Collections.Queue" /> .
Removes and returns the object at the beginning of the <see cref="T:System.Collections.Queue" /> .
public
void
Enqueue​(object obj)
obj
The object to add to the <see cref="T:System.Collections.Queue" /> . The value can be <see langword="null" /> .
Adds an object to the end of the <see cref="T:System.Collections.Queue" /> .
public
IEnumerator
GetEnumerator​() Returns An <see cref="T:System.Collections.IEnumerator" /> for the <see cref="T:System.Collections.Queue" /> .
Returns an enumerator that iterates through the <see cref="T:System.Collections.Queue" /> .
public
object
Peek​() Returns The object at the beginning of the <see cref="T:System.Collections.Queue" /> .
Returns the object at the beginning of the <see cref="T:System.Collections.Queue" /> without removing it.
public
object[]
ToArray​() Returns A new array containing elements copied from the <see cref="T:System.Collections.Queue" /> .
Copies the <see cref="T:System.Collections.Queue" /> elements to a new array.
public
void
TrimToSize​()
Sets the capacity to the actual number of elements in the <see cref="T:System.Collections.Queue" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object