<PackageReference Include="System.Collections.NonGeneric" Version="4.0.1-beta-23409" />

Stack

public class Stack : ICollection, IEnumerable
Represents a simple last-in-first-out (LIFO) non-generic collection of objects.
public virtual int Count { get; }

Gets the number of elements contained in the Stack.

public virtual bool IsSynchronized { get; }

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

public virtual object SyncRoot { get; }

Gets an object that can be used to synchronize access to the Stack.

public Stack()

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

public Stack(int initialCapacity)

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

public Stack(ICollection col)

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.

public static Stack Synchronized(Stack stack)

Returns a synchronized (thread safe) wrapper for the Stack.

public virtual void Clear()

Removes all objects from the Stack.

public virtual object Clone()

Creates a shallow copy of the Stack.

public virtual bool Contains(object obj)

Determines whether an element is in the Stack.

public virtual void CopyTo(Array array, int index)

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

public virtual IEnumerator GetEnumerator()

Returns an IEnumerator for the Stack.

public virtual object Peek()

Returns the object at the top of the Stack without removing it.

public virtual object Pop()

Removes and returns the object at the top of the Stack.

public virtual void Push(object obj)

Inserts an object at the top of the Stack.

public virtual object[] ToArray()

Copies the Stack to a new array.