mscorlib(4.0.0.0) API with additions
System.Collections.Queue Class Reference

Represents a first-in, first-out collection of objects. More...

Inheritance diagram for System.Collections.Queue:
[legend]
Collaboration diagram for System.Collections.Queue:
[legend]

Public Member Functions

 Queue ()
 Initializes a new instance of the T:System.Collections.Queue class that is empty, has the default initial capacity, and uses the default growth factor. More...
 
 Queue (int capacity)
 Initializes a new instance of the T:System.Collections.Queue class that is empty, has the specified initial capacity, and uses the default growth factor. More...
 
 Queue (int capacity, float growFactor)
 Initializes a new instance of the T:System.Collections.Queue class that is empty, has the specified initial capacity, and uses the specified growth factor. More...
 
 Queue??? (ICollection col)
 Initializes a new instance of the T:System.Collections.Queue class that contains elements copied from the specified collection, has the same initial capacity as the number of elements copied, and uses the default growth factor. More...
 
virtual object Clone ()
 Creates a shallow copy of the T:System.Collections.Queue. More...
 
virtual void Clear ()
 Removes all objects from the T:System.Collections.Queue. More...
 
virtual void CopyTo (Array array, int index)
 Copies the T:System.Collections.Queue elements to an existing one-dimensional T:System.Array, starting at the specified array index. More...
 
virtual void Enqueue (object obj)
 Adds an object to the end of the T:System.Collections.Queue. More...
 
virtual IEnumerator GetEnumerator ()
 Returns an enumerator that iterates through the T:System.Collections.Queue. More...
 
virtual object Dequeue ()
 Removes and returns the object at the beginning of the T:System.Collections.Queue. More...
 
virtual object Peek ()
 Returns the object at the beginning of the T:System.Collections.Queue without removing it. More...
 
virtual bool Contains (object obj)
 Determines whether an element is in the T:System.Collections.Queue. More...
 
virtual object [] ToArray ()
 Copies the T:System.Collections.Queue elements to a new array. More...
 
virtual void TrimToSize ()
 Sets the capacity to the actual number of elements in the T:System.Collections.Queue. More...
 

Static Public Member Functions

static Queue Synchronized (Queue queue)
 Returns a new T:System.Collections.Queue that wraps the original queue, and is thread safe. More...
 

Public Attributes

virtual int Count => _size
 Gets the number of elements contained in the T:System.Collections.Queue. More...
 
virtual bool IsSynchronized => false
 Gets a value indicating whether access to the T:System.Collections.Queue is synchronized (thread safe). More...
 

Properties

virtual object SyncRoot [get]
 Gets an object that can be used to synchronize access to the T:System.Collections.Queue. More...
 
- Properties inherited from System.Collections.ICollection
int Count [get]
 Gets the number of elements contained in the T:System.Collections.ICollection. More...
 
object SyncRoot [get]
 Gets an object that can be used to synchronize access to the T:System.Collections.ICollection. More...
 
bool IsSynchronized [get]
 Gets a value indicating whether access to the T:System.Collections.ICollection is synchronized (thread safe). More...
 

Detailed Description

Represents a first-in, first-out collection of objects.

Definition at line 13 of file Queue.cs.

Constructor & Destructor Documentation

◆ Queue() [1/3]

System.Collections.Queue.Queue ( )

Initializes a new instance of the T:System.Collections.Queue class that is empty, has the default initial capacity, and uses the default growth factor.

Definition at line 272 of file Queue.cs.

◆ Queue() [2/3]

System.Collections.Queue.Queue ( int  capacity)

Initializes a new instance of the T:System.Collections.Queue class that is empty, has the specified initial capacity, and uses the default growth factor.

Parameters
capacityThe initial number of elements that the T:System.Collections.Queue can contain.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.

Definition at line 281 of file Queue.cs.

◆ Queue() [3/3]

System.Collections.Queue.Queue ( int  capacity,
float  growFactor 
)

Initializes a new instance of the T:System.Collections.Queue class that is empty, has the specified initial capacity, and uses the specified growth factor.

Parameters
capacityThe initial number of elements that the T:System.Collections.Queue can contain.
growFactorThe factor by which the capacity of the T:System.Collections.Queue is expanded.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.-or- growFactor is less than 1.0 or greater than 10.0.

Definition at line 292 of file Queue.cs.

Member Function Documentation

◆ Clear()

virtual void System.Collections.Queue.Clear ( )
virtual

Removes all objects from the T:System.Collections.Queue.

Definition at line 346 of file Queue.cs.

◆ Clone()

virtual object System.Collections.Queue.Clone ( )
virtual

Creates a shallow copy of the T:System.Collections.Queue.

Returns
A shallow copy of the T:System.Collections.Queue.

Implements System.ICloneable.

Definition at line 329 of file Queue.cs.

◆ Contains()

virtual bool System.Collections.Queue.Contains ( object  obj)
virtual

Determines whether an element is in the T:System.Collections.Queue.

Parameters
objThe T:System.Object to locate in the T:System.Collections.Queue. The value can be null.
Returns
true if obj is found in the T:System.Collections.Queue; otherwise, false.

Definition at line 479 of file Queue.cs.

◆ CopyTo()

virtual void System.Collections.Queue.CopyTo ( Array  array,
int  index 
)
virtual

Copies the T:System.Collections.Queue elements to an existing one-dimensional T:System.Array, starting at the specified array index.

Parameters
arrayThe one-dimensional T:System.Array that is the destination of the elements copied from T:System.Collections.Queue. The T:System.Array must have zero-based indexing.
indexThe zero-based index in array at which copying begins.
Exceptions
T:System.ArgumentNullExceptionarray is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero.
T:System.ArgumentExceptionarray is multidimensional.-or- The number of elements in the source T:System.Collections.Queue is greater than the available space from index to the end of the destination array .
T:System.ArrayTypeMismatchExceptionThe type of the source T:System.Collections.Queue cannot be cast automatically to the type of the destination array .

Implements System.Collections.ICollection.

Definition at line 373 of file Queue.cs.

◆ Dequeue()

virtual object System.Collections.Queue.Dequeue ( )
virtual

Removes and returns the object at the beginning of the T:System.Collections.Queue.

Returns
The object that is removed from the beginning of the T:System.Collections.Queue.
Exceptions
T:System.InvalidOperationExceptionThe T:System.Collections.Queue is empty.

Definition at line 434 of file Queue.cs.

◆ Enqueue()

virtual void System.Collections.Queue.Enqueue ( object  obj)
virtual

Adds an object to the end of the T:System.Collections.Queue.

Parameters
objThe object to add to the T:System.Collections.Queue. The value can be null.

Definition at line 407 of file Queue.cs.

◆ GetEnumerator()

virtual IEnumerator System.Collections.Queue.GetEnumerator ( )
virtual

Returns an enumerator that iterates through the T:System.Collections.Queue.

Returns
An T:System.Collections.IEnumerator for the T:System.Collections.Queue.

Implements System.Collections.IEnumerable.

Definition at line 426 of file Queue.cs.

◆ Peek()

virtual object System.Collections.Queue.Peek ( )
virtual

Returns the object at the beginning of the T:System.Collections.Queue without removing it.

Returns
The object at the beginning of the T:System.Collections.Queue.
Exceptions
T:System.InvalidOperationExceptionThe T:System.Collections.Queue is empty.

Definition at line 451 of file Queue.cs.

◆ Queue???()

Initializes a new instance of the T:System.Collections.Queue class that contains elements copied from the specified collection, has the same initial capacity as the number of elements copied, and uses the default growth factor.

Parameters
colThe T:System.Collections.ICollection to copy elements from.
Exceptions
T:System.ArgumentNullExceptioncol is null.

Definition at line 313 of file Queue.cs.

◆ Synchronized()

static Queue System.Collections.Queue.Synchronized ( Queue  queue)
static

Returns a new T:System.Collections.Queue that wraps the original queue, and is thread safe.

Parameters
queueThe T:System.Collections.Queue to synchronize.
Returns
A T:System.Collections.Queue wrapper that is synchronized (thread safe).
Exceptions
T:System.ArgumentNullExceptionqueue is null.

Definition at line 466 of file Queue.cs.

◆ ToArray()

virtual object [] System.Collections.Queue.ToArray ( )
virtual

Copies the T:System.Collections.Queue elements to a new array.

Returns
A new array containing elements copied from the T:System.Collections.Queue.

Definition at line 508 of file Queue.cs.

◆ TrimToSize()

virtual void System.Collections.Queue.TrimToSize ( )
virtual

Sets the capacity to the actual number of elements in the T:System.Collections.Queue.

Exceptions
T:System.NotSupportedExceptionThe T:System.Collections.Queue is read-only.

Definition at line 550 of file Queue.cs.

Member Data Documentation

◆ Count

virtual int System.Collections.Queue.Count => _size

Gets the number of elements contained in the T:System.Collections.Queue.

Returns
The number of elements contained in the T:System.Collections.Queue.

Definition at line 250 of file Queue.cs.

◆ IsSynchronized

virtual bool System.Collections.Queue.IsSynchronized => false

Gets a value indicating whether access to the T:System.Collections.Queue is synchronized (thread safe).

Returns
true if access to the T:System.Collections.Queue is synchronized (thread safe); otherwise, false. The default is false.

Definition at line 255 of file Queue.cs.

Property Documentation

◆ SyncRoot

virtual object System.Collections.Queue.SyncRoot
get

Gets an object that can be used to synchronize access to the T:System.Collections.Queue.

Returns
An object that can be used to synchronize access to the T:System.Collections.Queue.

Definition at line 260 of file Queue.cs.


The documentation for this class was generated from the following file: