System.Collections.Queue Class

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

See Also: Queue Members

Syntax

[System.Diagnostics.DebuggerDisplay("Count={Count}")]
[System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.CollectionDebuggerView))]
[System.Runtime.InteropServices.ComVisible(true)]
public class Queue : ICollection, ICloneable

Remarks

Queues are useful for storing messages in the order they were received for sequential processing. This class implements a queue as a circular array. Objects stored in a Queue are inserted at one end and removed from the other.

The capacity of a Queue is the number of elements the Queue can hold. As elements are added to a Queue, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling Queue.TrimToSize.

The growth factor is the number by which the current capacity is multiplied when a greater capacity is required. The growth factor is determined when the Queue is constructed. The default growth factor is 2.0. The capacity of the Queue will always increase by at least a minimum of four, regardless of the growth factor. For example, a Queue with a growth factor of 1.0 will always increase in capacity by four when a greater capacity is required.

Queue accepts null as a valid value and allows duplicate elements.

For the generic version of this collection, see Queue`1

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0