Table of Contents

Class LinqExtensions

Namespace
System.Linq
Assembly
Arc4u.dll

Provides a set of static methods extending the IEnumerable<T> class.

public static class LinqExtensions
Inheritance
LinqExtensions
Inherited Members

Methods

Flatten<TSource>(IEnumerable<TSource>, Func<TSource, IEnumerable<TSource>>)

Take a collection of an object of type TSource and use the getChildrenFunction to travel the structure of the collection. In return, we have a flatten collection of each nodes.

public static IEnumerable<TSource> Flatten<TSource>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TSource>> getChildrenFunction)

Parameters

source IEnumerable<TSource>

An IEnumerable<T> to flatten recursively.

getChildrenFunction Func<TSource, IEnumerable<TSource>>

Return the property to use to travel through the node collection.

Returns

IEnumerable<TSource>

Type Parameters

TSource

The type of the elements of source.

Where<TSource>(IEnumerable<TSource>, Func<TSource, bool>, Func<TSource, IEnumerable<TSource>>)

Filters recursively a sequence of values based on a predicate.

public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, IEnumerable<TSource>> selector)

Parameters

source IEnumerable<TSource>

An IEnumerable<T> to filter recursively.

predicate Func<TSource, bool>

A function to test each element for a condition.

selector Func<TSource, IEnumerable<TSource>>

A recursive function to apply to each element.

Returns

IEnumerable<TSource>

An IEnumerable<T> that contains elements from the input sequence that satisfy the condition.

Type Parameters

TSource

The type of the elements of source.