System.Collections by Microsoft

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

 Stack<T>

Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type.

Enumerates the elements of a Stack<T>.

public int Count { get; }

Gets the number of elements contained in the Stack<T>.

public Stack()

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

public Stack(int capacity)

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

public Stack(IEnumerable<T> collection)

Initializes a new instance of the Stack<T> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.

public void Clear()

Removes all objects from the Stack<T>.

public bool Contains(T item)

Determines whether an element is in the Stack<T>.

public void CopyTo(T[] array, int arrayIndex)

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

Returns an enumerator for the Stack<T>.

public T Peek()

Returns the object at the top of the Stack<T> without removing it.

public T Pop()

Removes and returns the object at the top of the Stack<T>.

public void Push(T item)

Inserts an object at the top of the Stack<T>.

public T[] ToArray()

Copies the Stack<T> to a new array.

public void TrimExcess()

Sets the capacity to the actual number of elements in the Stack<T>, if that number is less than 90 percent of current capacity.