Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Code.​Collections / Enumerable­Extensions / Select­Many­Recursive

Method SelectManyRecursive

SelectManyRecursive<T>(IEnumerable<T>, Func<T, IEnumerable<T>>, Boolean)

Selects the closure of a graph. This is typically used to select all descendants of a tree node. This method returns distinct nodes only.

Declaration
public static IReadOnlyCollection<T> SelectManyRecursive<T>(this IEnumerable<T> collection, Func<T, IEnumerable<T>> getItems, bool throwOnDuplicate = true)
where T : class, ICompilationElement
Parameters
Type Name Description
IEnumerable<T> collection

The initial collection of items.

Func<T, IEnumerable<T>> getItems

A function that returns the set of all nodes connected to a given node.

Boolean throwOnDuplicate

true if an exception must be thrown if a duplicate if found.

Returns
Type Description
IReadOnlyCollection<T>
Type Parameters
Name Description
T