Class StackExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Provides extensions for the Stack<T> class.
public static class StackExtensions
- Inheritance
-
StackExtensions
- Inherited Members
Methods
Insert<T>(Stack<T>, T, int)
Inserts an element in the stack at the specified index.
public static void Insert<T>(this Stack<T> stack, T item, int index)
Parameters
stackStack<T>The stack.
itemTThe item to insert into the stack.
indexintThe index at which the item will be inserted.
Type Parameters
TThe type of the values stored in the stack.
Remarks
This is an expensive operation, due to the lack of the necessary public APIs for speeding up the insertion.
PopAll<T>(Stack<T>)
Pops all elements from the stack.
public static IEnumerable<T> PopAll<T>(this Stack<T> stack)
Parameters
stackStack<T>The stack.
Returns
- IEnumerable<T>
The popped elements in the order they were popped.
Type Parameters
TThe type of the elements contained in the stack.
PopRange<T>(Stack<T>, int)
Pops a range of elements from the stack.
public static IEnumerable<T> PopRange<T>(this Stack<T> stack, int count)
Parameters
Returns
- IEnumerable<T>
The popped elements in the order they were popped.
Type Parameters
TThe type of the elements contained in the stack.
PushRange<T>(Stack<T>, IEnumerable<T>)
Pushes a range of elements to the stack.
public static void PushRange<T>(this Stack<T> stack, IEnumerable<T> range)
Parameters
stackStack<T>The stack.
rangeIEnumerable<T>The elements to push.
Type Parameters
TThe type of the elements contained in the stack.