Class Stack
Provides various extension methods for class Stack<T>.
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public static class Stack
Methods
| Improve this Doc View SourceClone<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. |
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. |
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. |