Search Results for

Show / Hide Table of Contents

# Class StackExtensions

Extension of System.Collections.Generic.Stack<T> helper to work with specific System.Collections.Generic.IEqualityComparer<T>

##### Inheritance

System.Object
StackExtensions

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public static class StackExtensions

### Methods

#### Contains<T>(Stack<T>, T, IEqualityComparer<T>)

Check if the stack object contains the value to find.

##### Declaration

    public static bool Contains<T>(this Stack<T> stack, T valueToFind, IEqualityComparer<T> comparer = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.
T | valueToFind | Value to find.
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparison object.

##### Returns

Type | Description
--- | ---
System.Boolean | `true` If the value was found.`false` otherwise.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### FindDuplicates<T>(Stack<T>, IEqualityComparer<T>)

Find all duplicates stack objects values.

##### Declaration

    public static Stack<T> FindDuplicates<T>(this Stack<T> stack, IEqualityComparer<T> comparer = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparison object.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.Stack<T> | The duplicates stack object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### MoveNext<T>(Stack<T>)

Move the first stack object value to the end.

##### Declaration

    public static void MoveNext<T>(this Stack<T> stack)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### MovePrevious<T>(Stack<T>)

Move the last stack object value to the top.

##### Declaration

    public static void MovePrevious<T>(this Stack<T> stack)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### MoveTo<T>(Stack<T>, T, Int32, IEqualityComparer<T>)

Move the stack object value to the index.

##### Declaration

    public static void MoveTo<T>(this Stack<T> stack, T valueToMove, int index = 0, IEqualityComparer<T> comparer = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.
T | valueToMove | Value to move.
System.Int32 | index | The index where to move.
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparison object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### Replace<T>(Stack<T>, T, T, IEqualityComparer<T>)

Replaces an stack object values that match with the value to replace.

##### Declaration

    public static void Replace<T>(this Stack<T> stack, T valueToReplace, T valueToReplaceWith, IEqualityComparer<T> comparer = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.
T | valueToReplace | Value to replace.
T | valueToReplaceWith | Value to replace with to what matches the value to replace.
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparison object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.

#### Swap<T>(Stack<T>, T, T, IEqualityComparer<T>)

Swap two stack objects values that matches with the both values.

##### Declaration

    public static void Swap<T>(this Stack<T> stack, T valueToSwapFrom, T valueToSwapTo, IEqualityComparer<T> comparer = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.Stack<T> | stack | The stack object.
T | valueToSwapFrom | Value to swap from.
T | valueToSwapTo | Value to swap to.
System.Collections.Generic.IEqualityComparer<T> | comparer | The comparison object.

##### Type Parameters

Name | Description
--- | ---
T | The stack object type.