Table of Contents

TraverseWhileNotEmpty Method

Definition

Namespace
Cuemon.Extensions.Runtime
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/Runtime/Hierarchy.cs

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

Invokes the specified traversal path of source until obstructed by an empty sequence.

public static IEnumerable<TSource> TraverseWhileNotEmpty<TSource>(TSource source, Func<TSource, IEnumerable<TSource>> traversal) where TSource : class

Parameters

source TSource

The source to travel until the traversal path is obstructed by an empty sequence.

traversal Func<TSource, IEnumerable<TSource>>

The function delegate that is invoked until the traveled path is obstructed by an empty sequence.

Returns

IEnumerable<TSource>

An IEnumerable<T> sequence equal to the traveled path of source.

Type Parameters

TSource

The type of the source.

Exceptions

ArgumentNullException

source -or- traversal is null.