Time-based sequence creation
In the previous sections, we had the opportunity to create simple sequences from known values or by executing some specific code.
Although these opportunities give us the chance to create useful message sequences, in the real world, reactive programming deals with some kind of time-based messages.
Interval
The easiest form of time-based interaction is the polling design. This design, typical of nonreactive programming, happens anytime we ask for a value or a state at a fixed time interval. Similarly, within the reactive programming, we may produce messages at a fixed time interval running in a push design to use the value itself or to trigger other logics available in the following sequence chain.
The Interval
operator produces a similar design by specifying the wanted time interval, receiving a counter of the current tick as the Int64
value.
Here's an example:
static void Main(string[] args) { //this sequence produces a message per second ...