Search Results for

    Show / Hide Table of Contents

    Class EnumerableExtensions

    Inheritance
    object
    EnumerableExtensions
    Namespace: TetraCreations.Core
    Assembly: cs.temp.dll.dll
    Syntax
    public static class EnumerableExtensions

    Methods

    ChunkBy<T>(IList<T>, int)

    Chunk IEnumerable by size

    Declaration
    public static IEnumerable<IEnumerable<T>> ChunkBy<T>(this IList<T> source, int chunkSize)
    Parameters
    Type Name Description
    IList<><T> source
    int chunkSize
    Returns
    Type Description
    IEnumerable<><IEnumerable<><T>>
    Type Parameters
    Name Description
    T

    DistinctBy<T, TKey>(IEnumerable<T>, Func<T, TKey>)

    Group elements using a predicate function

    Declaration
    public static IEnumerable<T> DistinctBy<T, TKey>(this IEnumerable<T> enumerable, Func<T, TKey> keySelector)
    Parameters
    Type Name Description
    IEnumerable<><T> enumerable
    Func<, ><T, TKey> keySelector

    The predicate for the group by

    Returns
    Type Description
    IEnumerable<><T>
    Type Parameters
    Name Description
    T
    TKey

    IsNullOrEmpty(IEnumerable)

    Returns true if the IEnumerable is empty or null

    Declaration
    public static bool IsNullOrEmpty(this IEnumerable enumerable)
    Parameters
    Type Name Description
    IEnumerable enumerable
    Returns
    Type Description
    bool

    RemoveDuplicates<T>(ICollection<T>, Func<T, int>)

    Declaration
    public static IEnumerable<T> RemoveDuplicates<T>(this ICollection<T> list, Func<T, int> predicate)
    Parameters
    Type Name Description
    ICollection<><T> list
    Func<, ><T, int> predicate
    Returns
    Type Description
    IEnumerable<><T>
    Type Parameters
    Name Description
    T

    ToNonNullList<T>(IEnumerable<T>)

    Returns an empty list if it is null.

    Declaration
    public static List<T> ToNonNullList<T>(this IEnumerable<T> enumerable)
    Parameters
    Type Name Description
    IEnumerable<><T> enumerable
    Returns
    Type Description
    List<><T>
    Type Parameters
    Name Description
    T
    In This Article
    Back to top Tetra Creations documentation