Table of Contents

TraverseWhileNotNull Method

Definition

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

TraverseWhileNotNull<TSource>(TSource, Func<TSource, TSource>)

Invokes the specified traversal path of source until obstructed by a null value.

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

Parameters

source TSource

The source to travel until the traversal path is obstructed by a null value.

traversal Func<TSource, TSource>

The function delegate that is invoked until the traveled path is obstructed by a null value.

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.