Method Swap
Swap<T>(Stack<T>, T, T, IEqualityComparer<T>)
Swap two stack objects values that matches with the both values.
public static void Swap<T>(this Stack<T> stack, T valueToSwapFrom, T valueToSwapTo, IEqualityComparer<T> comparer = null)
Parameters
stack
Stack<T>The stack object.
valueToSwapFrom
TValue to swap from.
valueToSwapTo
TValue to swap to.
comparer
IEqualityComparer<T>The comparison object.
Type Parameters
T
The stack object type.