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 _
public Stack(
   ICollection col
public: Stack(
   ICollection* col
public function Stack(
   col : ICollection


The ICollection to copy elements from.


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


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.


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