Table of Contents

Method OrElse

Namespace
SodaFlow
Assembly
SodaFlow.dll

OrElse<T>(Stream<T>, Stream<T>)

Merges this stream with a second stream and drops the value of the second stream when they are simultaneous.

public static Stream<T> OrElse<T>(this Stream<T> s, Stream<T> s2)

Parameters

s Stream<T>

The stream.

s2 Stream<T>

The stream to merge with.

Returns

Stream<T>

A stream from a merge of this stream with a second stream. It drops the value of the second stream when the two are simultaneous.

Type Parameters

T

The type of the stream.

Remarks

Where two stream events are simultaneous, which means that the two are in the same transaction, the event value from this stream has precedence. The result drops the event value from s2. To specify a custom combining function, use Merge<T>(Stream<T>, Stream<T>, Func<T, T, T>) . s1.OrElse(s2) is equivalent to s1.Merge(s2, (l, r) => l).

This has the name OrElse and not Merge, to make it clear that a precaution is necessary, because the result can drop a stream event.

OrElse<T>(IEnumerable<Stream<T>>)

Merges a collection of streams and drops the value of the stream earlier in the collection when they are simultaneous.

public static Stream<T> OrElse<T>(this IEnumerable<Stream<T>> s)

Parameters

s IEnumerable<Stream<T>>

The collection of streams to merge.

Returns

Stream<T>

A stream from a merge of the collection of streams. It drops the value of the stream earlier in the collection when the two are simultaneous.

Type Parameters

T