Composite by Vitaly Kamiansky, Vladimir Ilin

<PackageReference Include="Composite" Version="1.5.5" />

 CompositeExtensions

public class CompositeExtensions

public static IEnumerable<T> AsEnumerable<T>(Composite<T> source)

Views the given composite as an enumerable.

public static IEnumerable<MarkValuePair<TMark, TPayload>> AsEnumerable<TMark, TPayload>(Composite<TMark, TPayload> source)

Views the given marked composite as an enumerable.

public static Composite<TMark, TPayload> EnsureHasContainer<TMark, TPayload>(Composite<TMark, TPayload> source, TMark outerContainerMark, TMark innerContainerMark, Func<TMark, TMark, bool> markComparer)

Builds a new marked composite based on the source ensuring that a container will be present at the given mark in the given container.

public static Composite<T> Fork<T>(Composite<T> source, Func<T, bool> predicate, Func<T, IEnumerable<T>> mapping)

Builds a new composite based on the source in which the values for which the given predicate returns true are substituted for composites containing the objects produced by using the given function as their value components.

public static Composite<TOut> Select<TIn, TOut>(Composite<TIn> source, Func<TIn, TOut> mapping)

Builds a new composite based on the source in which the values are the results of applying the given function to each of the values in the input composite.

public static Composite<TMark, TPayload> SetValue<TMark, TPayload>(Composite<TMark, TPayload> source, TMark containerMark, TMark valueMark, TPayload value, Func<TMark, TMark, bool> markComparer)

Builds a new marked composite based on the source in which the value is set at the given mark in the given container.

public static IEnumerable<Composite<T>> ToComponents<T>(Composite<T> source)

Returns the enumerable of components of the input composite.

public static IEnumerable<Composite<TMark, TPayload>> ToComponents<TMark, TPayload>(Composite<TMark, TPayload> source)

Returns the enumerable of components of the input marked composite.