Skip to content

IEnumerableExtensions

General-purpose LINQ gap-fillers: eager iteration, string-joining, membership testing, trailing-item selection, keyed distinct, and full/left outer joins. (BR-039, BR-085) through BR-088

Purpose

  • General-purpose LINQ gap-fillers: eager iteration, string-joining, membership testing, trailing-item selection, keyed distinct, and full/left outer joins. (BR-039, BR-085) through BR-088

Context

  • Namespace: SAIF.Common.Extensions
  • Assembly/package: SAIF.Framework.Common

Public members

Member Signature Purpose
ForEach(this IEnumerable source, Action action) public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) Eagerly invokes action for every element of source. (BR-039)
ToStringAll(this IEnumerable source, string separator) public static string ToStringAll<T>(this IEnumerable<T> source, string separator) Joins each element's ToString() with separator. (BR-039, BR-085)
ToStringAll(this IEnumerable source, string separator, Func function) public static string ToStringAll<T>(this IEnumerable<T> source, string separator, Func<T,string> function) Joins each element's custom string projection with separator. (BR-039, BR-085)
IsIn(this T value, params T[] set) public static bool IsIn<T>(this T value, params T[] set) Tests whether value is a member of the supplied set.
TakeFromEnd(this IEnumerable source, int count) public static IEnumerable<T> TakeFromEnd<T>(this IEnumerable<T> source, int count) Returns the trailing count elements, preserving their original relative order. (BR-086)
Distinct(this IEnumerable source, Func keySelector) public static IEnumerable<TSource> Distinct<TSource,TKey>(this IEnumerable<TSource> source, Func<TSource,TKey> keySelector) Returns the first element for each distinct key, a "distinct-by" LINQ does not provide natively. (BR-087)
None(this IEnumerable source, Func predicate) public static bool None<TSource>(this IEnumerable<TSource> source, Func<TSource,bool> predicate) The negation of Any(predicate).
ToLowerAll(this IEnumerable source) public static IEnumerable<string> ToLowerAll(this IEnumerable<string> source) Lower-cases every string in the sequence.
FullOuterGroupJoin(this IEnumerable a, IEnumerable b, Func selectKeyA, Func selectKeyB, Func<TA,IEnumerable,TKey,TResult> projection, TA defaultA, TB defaultB, IEqualityComparer comparer) public static IEnumerable<TResult> FullOuterGroupJoin<TA,TB,TKey,TResult>(this IEnumerable<TA> a, IEnumerable<TB> b, Func<TA,TKey> selectKeyA, Func<TB,TKey> selectKeyB, Func<TA,IEnumerable<TB>,TKey,TResult> projection, TA defaultA = default(TA), TB defaultB = default(TB), IEqualityComparer<TKey> comparer = null) Full outer group-join over two sequences, substituting the supplied defaults where one side has no match. (BR-088)
FullOuterJoin(this IEnumerable a, IEnumerable b, Func selectKeyA, Func selectKeyB, Func projection, TA defaultA, TB defaultB, IEqualityComparer comparer) public static IEnumerable<TResult> FullOuterJoin<TA,TB,TKey,TResult>(this IEnumerable<TA> a, IEnumerable<TB> b, Func<TA,TKey> selectKeyA, Func<TB,TKey> selectKeyB, Func<TA,TB,TKey,TResult> projection, TA defaultA = default(TA), TB defaultB = default(TB), IEqualityComparer<TKey> comparer = null) Full outer join over two sequences, substituting the supplied defaults where one side has no match. (BR-088)
LeftOuterJoin(this IEnumerable a, IEnumerable b, Func selectKeyA, Func selectKeyB, Func projection, TB defaultB, IEqualityComparer comparer) public static IEnumerable<TResult> LeftOuterJoin<TA,TB,TKey,TResult>(this IEnumerable<TA> a, IEnumerable<TB> b, Func<TA,TKey> selectKeyA, Func<TB,TKey> selectKeyB, Func<TA,TB,TKey,TResult> projection, TB defaultB = default(TB), IEqualityComparer<TKey> comparer = null) Left outer join keyed only on the left sequence's keys, substituting defaultB where the right side has no match. (BR-088)

Sources

  • Common/SAIF.Common/Extensions/IEnumerableExtensions.cs