Enqueue Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Adds an object to the end of the Queue.

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)

public virtual void Enqueue(
	Object obj
)

Parameters

obj
Type: System..::..Object
The object to add to the Queue. The value can be nullNothingnullptrunita null reference (Nothing in Visual Basic).

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 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 capacity of the Queue will always increase by a minimum value, regardless of the growth factor; a growth factor of 1.0 will not prevent the Queue from increasing in size.

If Count is less than the capacity of the internal array, this method is an O(1) operation. If the internal array needs to be reallocated to accommodate the new element, this method becomes an O(n) operation, where n is Count.

Show: