Show / Hide Table of Contents

    Class CollectionExtensions

    Inheritance
    Object
    CollectionExtensions
    Namespace: QFSW.QC.Utilities
    Assembly: QFSW.QC.dll
    Syntax
    public static class CollectionExtensions

    Methods

    DistinctBy<TValue, TDistinct>(IEnumerable<TValue>, Func<TValue, TDistinct>)

    Creates a distinct stream based on a custom predicate.

    Declaration
    public static IEnumerable<TValue> DistinctBy<TValue, TDistinct>(this IEnumerable<TValue> source, Func<TValue, TDistinct> predicate)
    Parameters
    Type Name Description
    IEnumerable<TValue> source

    The source IEnumerable.

    Func<TValue, TDistinct> predicate

    The custom distinct item producer.

    Returns
    Type Description
    IEnumerable<TValue>

    The distinct stream.

    Type Parameters
    Name Description
    TValue

    The type of the IEnumerable.

    TDistinct

    The type of the value to test for distinctness.

    InsertionSortBy<T>(IList<T>, Func<T, Int32>)

    Declaration
    public static void InsertionSortBy<T>(this IList<T> collection, Func<T, int> keySelector)
    Parameters
    Type Name Description
    IList<T> collection
    Func<T, Int32> keySelector
    Type Parameters
    Name Description
    T

    Invert<TKey, TValue>(IDictionary<TKey, TValue>)

    Inverts the key/value relationship between the items in the dictionary.

    Declaration
    public static Dictionary<TValue, TKey> Invert<TKey, TValue>(this IDictionary<TKey, TValue> source)
    Parameters
    Type Name Description
    IDictionary<TKey, TValue> source
    Returns
    Type Description
    Dictionary<TValue, TKey>

    Dictionary with the inverted relationship.

    Type Parameters
    Name Description
    TKey
    TValue

    LastOr<T>(IEnumerable<T>, T)

    Declaration
    public static T LastOr<T>(this IEnumerable<T> source, T value)
    Parameters
    Type Name Description
    IEnumerable<T> source
    T value
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    Reversed<T>(IReadOnlyList<T>)

    Reverses the order of the sequence.

    Declaration
    public static IEnumerable<T> Reversed<T>(this IReadOnlyList<T> source)
    Parameters
    Type Name Description
    IReadOnlyList<T> source
    Returns
    Type Description
    IEnumerable<T>
    Type Parameters
    Name Description
    T

    SkipLast<T>(IEnumerable<T>)

    Skips the last element in the sequence.

    Declaration
    public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source)
    Parameters
    Type Name Description
    IEnumerable<T> source
    Returns
    Type Description
    IEnumerable<T>
    Type Parameters
    Name Description
    T

    SubArray<T>(T[], Int32, Int32)

    Gets a sub array of an existing array.

    Declaration
    public static T[] SubArray<T>(this T[] data, int index, int length)
    Parameters
    Type Name Description
    T[] data
    Int32 index

    Index to take the sub array from.

    Int32 length

    The length of the sub array.

    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T

    Yield<T>(T)

    Declaration
    public static IEnumerable<T> Yield<T>(this T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    IEnumerable<T>
    Type Parameters
    Name Description
    T
    Quantum Console by QFSW
    Back to top