This documentation is archived and is not being maintained.

Stack Constructor (ICollection)

.NET Framework 1.1

Initializes a new instance of the Stack class that contains elements copied from the specified collection and has the same initial capacity as the number of elements copied.

[Visual Basic]
Public Sub New( _
   ByVal col As ICollection _
)
[C#]
public Stack(
   ICollection col
);
[C++]
public: Stack(
   ICollection* col
);
[JScript]
public function Stack(
   col : ICollection
);

Parameters

col
The ICollection to copy elements from.

Exceptions

Exception Type Condition
ArgumentNullException col is a null reference (Nothing in Visual Basic).

Remarks

The initial capacity is the starting capacity of the new Stack. If the number of elements added to the stack reaches the current capacity, the capacity is automatically doubled.

The elements are copied onto the Stack in the same order they are read by the IEnumerator of the ICollection.

Requirements

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

See Also

Stack Class | Stack Members | System.Collections Namespace | Stack Constructor Overload List | ICollection | IEnumerator

Show: