This documentation is archived and is not being maintained.

Queue Constructor (Int32, Single)

.NET Framework 1.1

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

[Visual Basic]
Public Sub New( _
   ByVal capacity As Integer, _
   ByVal growFactor As Single _
public Queue(
   int capacity,
 float growFactor
public: Queue(
   int capacity,
 float growFactor
public function Queue(
   capacity : int,
 growFactor : float


The initial number of elements that the Queue can contain.
The factor by which the capacity of the Queue is expanded.


Exception Type Condition
ArgumentOutOfRangeException capacity is less than zero.


growFactor is less than 1.0 or greater than 10.0.


The initial capacity is the starting capacity of the new Queue. The growth factor is the number by which the current capacity is multiplied when a greater capacity is required. The default initial capacity is 32 and the default growth factor is 2.0.

If the number of elements added to the Queue reaches the current capacity, the capacity is automatically increased. The new capacity is determined by multiplying the current capacity by the growth factor.

If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the Queue.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Queue Class | Queue Members | System.Collections Namespace | Queue Constructor Overload List