mscorlib(4.0.0.0) API with additions
System.Collections.Stack Class Reference

Represents a simple last-in-first-out (LIFO) non-generic collection of objects. More...

Inheritance diagram for System.Collections.Stack:
[legend]
Collaboration diagram for System.Collections.Stack:
[legend]

Public Member Functions

 Stack ()
 Initializes a new instance of the T:System.Collections.Stack class that is empty and has the default initial capacity. More...
 
 Stack (int initialCapacity)
 Initializes a new instance of the T:System.Collections.Stack class that is empty and has the specified initial capacity or the default initial capacity, whichever is greater. More...
 
 Stack??? (ICollection col)
 Initializes a new instance of the T:System.Collections.Stack class that contains elements copied from the specified collection and has the same initial capacity as the number of elements copied. More...
 
virtual void Clear ()
 Removes all objects from the T:System.Collections.Stack. More...
 
virtual object Clone ()
 Creates a shallow copy of the T:System.Collections.Stack. More...
 
virtual bool Contains (object obj)
 Determines whether an element is in the T:System.Collections.Stack. More...
 
virtual void CopyTo (Array array, int index)
 Copies the T:System.Collections.Stack to an existing one-dimensional T:System.Array, starting at the specified array index. More...
 
virtual IEnumerator GetEnumerator ()
 Returns an T:System.Collections.IEnumerator for the T:System.Collections.Stack. More...
 
virtual object Peek ()
 Returns the object at the top of the T:System.Collections.Stack without removing it. More...
 
virtual object Pop ()
 Removes and returns the object at the top of the T:System.Collections.Stack. More...
 
virtual void Push (object obj)
 Inserts an object at the top of the T:System.Collections.Stack. More...
 
virtual object [] ToArray ()
 Copies the T:System.Collections.Stack to a new array. More...
 

Static Public Member Functions

static Stack Synchronized (Stack stack)
 Returns a synchronized (thread safe) wrapper for the T:System.Collections.Stack. More...
 

Public Attributes

virtual int Count => _size
 Gets the number of elements contained in the T:System.Collections.Stack. More...
 
virtual bool IsSynchronized => false
 Gets a value indicating whether access to the T:System.Collections.Stack is synchronized (thread safe). More...
 

Properties

virtual object SyncRoot [get]
 Gets an object that can be used to synchronize access to the T:System.Collections.Stack. More...
 
- Properties inherited from System.Collections.ICollection
int Count [get]
 Gets the number of elements contained in the T:System.Collections.ICollection. More...
 
object SyncRoot [get]
 Gets an object that can be used to synchronize access to the T:System.Collections.ICollection. More...
 
bool IsSynchronized [get]
 Gets a value indicating whether access to the T:System.Collections.ICollection is synchronized (thread safe). More...
 

Detailed Description

Represents a simple last-in-first-out (LIFO) non-generic collection of objects.

Definition at line 13 of file Stack.cs.

Constructor & Destructor Documentation

◆ Stack() [1/2]

System.Collections.Stack.Stack ( )

Initializes a new instance of the T:System.Collections.Stack class that is empty and has the default initial capacity.

Definition at line 258 of file Stack.cs.

◆ Stack() [2/2]

System.Collections.Stack.Stack ( int  initialCapacity)

Initializes a new instance of the T:System.Collections.Stack class that is empty and has the specified initial capacity or the default initial capacity, whichever is greater.

Parameters
initialCapacityThe initial number of elements that the T:System.Collections.Stack can contain.
Exceptions
T:System.ArgumentOutOfRangeExceptioninitialCapacity is less than zero.

Definition at line 269 of file Stack.cs.

Member Function Documentation

◆ Clear()

virtual void System.Collections.Stack.Clear ( )
virtual

Removes all objects from the T:System.Collections.Stack.

Definition at line 303 of file Stack.cs.

◆ Clone()

virtual object System.Collections.Stack.Clone ( )
virtual

Creates a shallow copy of the T:System.Collections.Stack.

Returns
A shallow copy of the T:System.Collections.Stack.

Implements System.ICloneable.

Definition at line 312 of file Stack.cs.

◆ Contains()

virtual bool System.Collections.Stack.Contains ( object  obj)
virtual

Determines whether an element is in the T:System.Collections.Stack.

Parameters
objThe object to locate in the T:System.Collections.Stack. The value can be null.
Returns
true, if obj is found in the T:System.Collections.Stack; otherwise, false.

Definition at line 325 of file Stack.cs.

◆ CopyTo()

virtual void System.Collections.Stack.CopyTo ( Array  array,
int  index 
)
virtual

Copies the T:System.Collections.Stack to an existing one-dimensional T:System.Array, starting at the specified array index.

Parameters
arrayThe one-dimensional T:System.Array that is the destination of the elements copied from T:System.Collections.Stack. The T:System.Array must have zero-based indexing.
indexThe zero-based index in array at which copying begins.
Exceptions
T:System.ArgumentNullExceptionarray is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero.
T:System.ArgumentExceptionarray is multidimensional.-or- The number of elements in the source T:System.Collections.Stack is greater than the available space from index to the end of the destination array .
T:System.InvalidCastExceptionThe type of the source T:System.Collections.Stack cannot be cast automatically to the type of the destination array .

Implements System.Collections.ICollection.

Definition at line 355 of file Stack.cs.

◆ GetEnumerator()

virtual IEnumerator System.Collections.Stack.GetEnumerator ( )
virtual

Returns an T:System.Collections.IEnumerator for the T:System.Collections.Stack.

Returns
An T:System.Collections.IEnumerator for the T:System.Collections.Stack.

Implements System.Collections.IEnumerable.

Definition at line 393 of file Stack.cs.

◆ Peek()

virtual object System.Collections.Stack.Peek ( )
virtual

Returns the object at the top of the T:System.Collections.Stack without removing it.

Returns
The T:System.Object at the top of the T:System.Collections.Stack.
Exceptions
T:System.InvalidOperationExceptionThe T:System.Collections.Stack is empty.

Definition at line 401 of file Stack.cs.

◆ Pop()

virtual object System.Collections.Stack.Pop ( )
virtual

Removes and returns the object at the top of the T:System.Collections.Stack.

Returns
The T:System.Object removed from the top of the T:System.Collections.Stack.
Exceptions
T:System.InvalidOperationExceptionThe T:System.Collections.Stack is empty.

Definition at line 413 of file Stack.cs.

◆ Push()

virtual void System.Collections.Stack.Push ( object  obj)
virtual

Inserts an object at the top of the T:System.Collections.Stack.

Parameters
objThe T:System.Object to push onto the T:System.Collections.Stack. The value can be null.

Definition at line 427 of file Stack.cs.

◆ Stack???()

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

Parameters
colThe T:System.Collections.ICollection to copy elements from.
Exceptions
T:System.ArgumentNullExceptioncol is null.

Definition at line 288 of file Stack.cs.

◆ Synchronized()

static Stack System.Collections.Stack.Synchronized ( Stack  stack)
static

Returns a synchronized (thread safe) wrapper for the T:System.Collections.Stack.

Parameters
stackThe T:System.Collections.Stack to synchronize.
Returns
A synchronized wrapper around the T:System.Collections.Stack.
Exceptions
T:System.ArgumentNullExceptionstack is null.

Definition at line 445 of file Stack.cs.

◆ ToArray()

virtual object [] System.Collections.Stack.ToArray ( )
virtual

Copies the T:System.Collections.Stack to a new array.

Returns
A new array containing copies of the elements of the T:System.Collections.Stack.

Definition at line 456 of file Stack.cs.

Member Data Documentation

◆ Count

virtual int System.Collections.Stack.Count => _size

Gets the number of elements contained in the T:System.Collections.Stack.

Returns
The number of elements contained in the T:System.Collections.Stack.

Definition at line 236 of file Stack.cs.

◆ IsSynchronized

virtual bool System.Collections.Stack.IsSynchronized => false

Gets a value indicating whether access to the T:System.Collections.Stack is synchronized (thread safe).

Returns
true, if access to the T:System.Collections.Stack is synchronized (thread safe); otherwise, false. The default is false.

Definition at line 241 of file Stack.cs.

Property Documentation

◆ SyncRoot

virtual object System.Collections.Stack.SyncRoot
get

Gets an object that can be used to synchronize access to the T:System.Collections.Stack.

Returns
An T:System.Object that can be used to synchronize access to the T:System.Collections.Stack.

Definition at line 246 of file Stack.cs.


The documentation for this class was generated from the following file: