Table of Contents

Class SharedFlow<T>

Namespace
PatternKit.Behavioral.Iterator
Assembly
PatternKit.Core.dll

A shared, replayable flow (backed by ReplayableSequence<T>) enabling multi-consumer forking, branching (partition), and additional functional transformation while guaranteeing each upstream element is materialized at most once.

public sealed class SharedFlow<T>

Type Parameters

T
Inheritance
SharedFlow<T>
Inherited Members
Extension Methods

Methods

AsFlow()

Expose the underlying enumeration (replayable) as a regular flow.

public Flow<T> AsFlow()

Returns

Flow<T>

Branch(Func<T, bool>)

Partition the stream into two flows based on predicate without re-enumerating upstream.

public (Flow<T> True, Flow<T> False) Branch(Func<T, bool> predicate)

Parameters

predicate Func<T, bool>

Returns

(Flow<T> True, Flow<T> False)

Filter(Func<T, bool>)

Filter values in a shared fashion.

public Flow<T> Filter(Func<T, bool> predicate)

Parameters

predicate Func<T, bool>

Returns

Flow<T>

Fork()

Create a new fork (cursor snapshot) that behaves as an independent Flow<T>.

public Flow<T> Fork()

Returns

Flow<T>

Fork(int)

Create count forks at the current root.

public Flow<T>[] Fork(int count)

Parameters

count int

Returns

Flow<T>[]

Map<TOut>(Func<T, TOut>)

Map values in a shared fashion (still uses replay cursor per enumeration).

public Flow<TOut> Map<TOut>(Func<T, TOut> selector)

Parameters

selector Func<T, TOut>

Returns

Flow<TOut>

Type Parameters

TOut