Table of Contents

Class CollectionExtensions

Namespace
RandomizerCore.Extensions
Assembly
RandomizerCore.dll
public static class CollectionExtensions
Inheritance
CollectionExtensions
Inherited Members

Methods

ArgMax<T>(IEnumerable<T>)

Returns the first maximal element of the sequence.

public static T ArgMax<T>(this IEnumerable<T> ts) where T : IComparable<T>

Parameters

ts IEnumerable<T>

Returns

T

Type Parameters

T

ArgMax<T, U>(IEnumerable<T>, Func<T, U>)

Returns the first maximal element of the transformed sequence.

public static T ArgMax<T, U>(this IEnumerable<T> ts, Func<T, U> selector) where U : IComparable<U>

Parameters

ts IEnumerable<T>
selector Func<T, U>

Returns

T

Type Parameters

T
U

ArgMin<T>(IEnumerable<T>)

Returns the first minimal element of the sequence.

public static T ArgMin<T>(this IEnumerable<T> ts) where T : IComparable<T>

Parameters

ts IEnumerable<T>

Returns

T

Type Parameters

T

ArgMin<T, U>(IEnumerable<T>, Func<T, U>)

Returns the first minimal element of the transformed sequence.

public static T ArgMin<T, U>(this IEnumerable<T> ts, Func<T, U> selector) where U : IComparable<U>

Parameters

ts IEnumerable<T>
selector Func<T, U>

Returns

T

Type Parameters

T
U

IndexMin<T, U>(IEnumerable<T>, Func<T, U>)

Returns the index of the first minimal element of the transformed sequence.

public static int IndexMin<T, U>(this IEnumerable<T> ts, Func<T, U> selector) where U : IComparable<U>

Parameters

ts IEnumerable<T>
selector Func<T, U>

Returns

int

Type Parameters

T
U

StableSort<T>(IList<T>)

Sorts the list according to the default comparer for its elements, preserving the order of elements which compare equal.

public static void StableSort<T>(this IList<T> ts) where T : IComparable<T>

Parameters

ts IList<T>

Type Parameters

T

StableSort<T>(IList<T>, IComparer<T>)

Sorts the list according to the provided comparer for its elements, preserving the order of elements which compare equal.

public static void StableSort<T>(this IList<T> ts, IComparer<T> comparer)

Parameters

ts IList<T>
comparer IComparer<T>

Type Parameters

T

StableSort<T>(IList<T>, Comparison<T>)

Sorts the list according to the provided comparison for its elements, preserving the order of elements which compare equal.

public static void StableSort<T>(this IList<T> ts, Comparison<T> comparison)

Parameters

ts IList<T>
comparison Comparison<T>

Type Parameters

T

TryDequeue<T>(Queue<T>, out T)

If the queue is nonempty, dequeues an element, outputting the result, and returns true. Otherwise, returns false.

public static bool TryDequeue<T>(this Queue<T> ts, out T t)

Parameters

ts Queue<T>
t T

Returns

bool

Type Parameters

T

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

If the queue is nonempty, peeks the queue, outputting the result, and returns true. Otherwise, returns false.

public static bool TryPeek<T>(this Queue<T> ts, out T t)

Parameters

ts Queue<T>
t T

Returns

bool

Type Parameters

T

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

If the stack is nonempty, peeks the stack, outputting the result, and returns true. Otherwise, returns false.

public static bool TryPeek<T>(this Stack<T> ts, out T t)

Parameters

ts Stack<T>
t T

Returns

bool

Type Parameters

T

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

If the stack is nonempty, pops the stack, outputting the result, and returns true. Otherwise, returns false.

public static bool TryPop<T>(this Stack<T> ts, out T t)

Parameters

ts Stack<T>
t T

Returns

bool

Type Parameters

T