System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="6.0.0-preview.3.21201.4" />

.NET API 192,384 bytes

 ImmutableStack<T>

public sealed class ImmutableStack<T> : IImmutableStack<T>, IEnumerable<T>, IEnumerable
Represents an immutable stack. NuGet package: System.Collections.Immutable (about immutable collections and how to install)
public struct Enumerator<T>

Enumerates the contents of an immutable stack without allocating any memory. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public static ImmutableStack<T> Empty { get; }

Gets an empty immutable stack.

public bool IsEmpty { get; }

Gets a value that indicates whether this instance of the immutable stack is empty.

public ImmutableStack<T> Clear()

Removes all objects from the immutable stack.

Returns an enumerator that iterates through the immutable stack.

public T Peek()

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

public ImmutableStack<T> Pop()

Removes the element at the top of the immutable stack and returns the stack after the removal.

public ImmutableStack<T> Pop(out T value)

Removes the specified element from the immutable stack and returns the stack after the removal.

public ImmutableStack<T> Push(T value)

Inserts an object at the top of the immutable stack and returns the new stack.