Class Concat
Represents an operator that concatenates any number of observable sequences as long as the previous sequence terminated successfully.
The Concat
operator allows you to combine the output of multiple sequences of the same type into a single sequence. Concat
subscribes to each sequence in turn, emits all the values from that sequence until successful termination, and then subscribes to the next sequence. Each sequence is guaranteed to only start after the previous one terminates.
The resulting sequence will terminate successfully when the last source sequence has terminated successfully, or exceptionally as soon as any sequence produces an error.
Examples
Use Concat
to sequentially combine the outputs of multiple sequences.
Stimulus Composition
Use Concat
to create a stimulus sequence by combining multiple preloaded or defined sequences.
Note
This example requires the Bonsai.Vision
and Bonsai.Vision.Design
packages to be installed. Load separate images into each LoadImage
operator.
Alternative
Use Merge
if you want to combine sequences in parallel online.
Higher-order operator
Concat
also works as a higher-order operator, so it can take as input a sequence of observable sequences. In this case, it will subscribe to the first source sequence and start passing along all emitted values. As soon as that sequence terminates, it will subscribe to the next received sequence, either immediately if it arrived before termination of the first sequence, or as soon as a new observable sequence is emitted.
The higher-order variant is useful to queue execution of long-running operations, for example to sequence logic states in a task, or merging video files in a folder sequentially into a single frame sequence.
[Combinator]
public class Concat
- Inheritance
-
Concat
- Inherited Members
Methods
- Process<TSource>(IObservable<IEnumerable<TSource>>)
Concatenates all inner enumerable sequences into one observable sequence.
- Process<TSource>(IObservable<IObservable<TSource>>)
Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
- Process<TSource>(IObservable<TSource>, IObservable<TSource>)
Concatenates the second observable sequence to the first observable sequence upon successful termination of the first.
- Process<TSource>(IObservable<TSource>, IObservable<TSource>, params IObservable<TSource>[])
Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.