Show / Hide Table of Contents

Class Stack

Provides various extension methods for class Stack<T>.

Inheritance
Object
Stack
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public static class Stack

Methods

| Improve this Doc View Source

Clone<T>(Stack<T>)

Creates a clone of the stack preserving order of elements into it.

Declaration
public static Stack<T> Clone<T>(this Stack<T> original)
Parameters
Type Name Description
Stack<T> original

The stack to clone.

Returns
Type Description
Stack<T>

A cloned stack.

Type Parameters
Name Description
T

Type of elements in the stack.

| Improve this Doc View Source

TryPeek<T>(Stack<T>, out T)

Attempts to obtain an object at the top of the stack without removing it.

Declaration
public static bool TryPeek<T>(this Stack<T> stack, out T obj)
Parameters
Type Name Description
Stack<T> stack

Stack instance.

T obj

An object at the top of the stack.

Returns
Type Description
Boolean

true if stack is not empty and object at the top of the stack exists; otherwise, false.

Type Parameters
Name Description
T

The type of elements in the stack.

| Improve this Doc View Source

TryPop<T>(Stack<T>, out T)

Attempts to remove object at the top of the stack.

Declaration
public static bool TryPop<T>(this Stack<T> stack, out T obj)
Parameters
Type Name Description
Stack<T> stack

Stack instance.

T obj

An object at the top of the stack.

Returns
Type Description
Boolean

true if stack is not empty and object at the top of the stack exists; otherwise, false.

Type Parameters
Name Description
T

The type of elements in the stack.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX