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.

public static IReadOnlyCollection<T> SelectManyRecursive<T>(this IEnumerable<T> collection, Func<T, IEnumerable<T>> getItems, bool throwOnDuplicate = true)
where T : class, ICompilationElement
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.

Type Description
Type Parameters
Name Description