Questions tagged [rx.net]

The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.

The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.

Resources:

264 questions
31
votes
2 answers

C# method overload resolution issues in Visual Studio 2013

Having these three methods available in Rx.NET library public static IObservable Create(Func, CancellationToken, Task> subscribeAsync) {...} public static IObservable
Mooh
  • 744
  • 5
  • 25
31
votes
4 answers

How to call back async function from Rx Subscribe?

I would like to call back an async function within an Rx subscription. E.g. like that: public class Consumer { private readonly Service _service = new Service(); public ReplaySubject Results = new ReplaySubject(); …
28
votes
3 answers

How can I clear the buffer on a ReplaySubject?

How can I clear the buffer on a ReplaySubject? Periodically I need to clear the buffer (as an end of day event in my case) to prevent the ReplaySubject continually growing and eventually eating all the memory. Ideally I want to keep the same…
CodingHero
  • 2,865
  • 6
  • 29
  • 42
14
votes
1 answer

RxJS/Rx.Net Observable-subscribe vs events - Performance/Threads

I recently started working on Reactive Extensions, mostly observables at client side using Angular 2. The concept of observables of Rx and events of dotnet seems to be very similar. Are there any specific examples where one is applicable and other…
Sreenath
  • 337
  • 2
  • 9
13
votes
4 answers

Trouble Implementing a Sliding Window in Rx

I created a SlidingWindow operator for reactive extensions because I want to easily monitor things like rolling averages, etc. As a simple example, I want to subscribe to hear mouse events, but each time there's an event I want to receive the last…
blaster
  • 8,876
  • 11
  • 48
  • 77
12
votes
2 answers

Why is IEnumerable.ToObservable so slow?

I am trying to enumerate a large IEnumerable once, and observe the enumeration with various operators attached (Count, Sum, Average etc). The obvious way is to transform it to an IObservable with the method ToObservable, and then subscribe an…
Theodor Zoulias
  • 34,835
  • 7
  • 69
  • 104
12
votes
1 answer

Schedulers: Immediate vs. CurrentThread

After reading the explanation for why Observable.Return(5) .Repeat() .Take(1) never completes, but Observable.Return(5, Scheduler.CurrentThread) .Repeat() .Take(1) works as expected. I am still confused and I can't tell why CurrentThread…
Sergi Mansilla
  • 12,495
  • 10
  • 39
  • 48
11
votes
3 answers

Reactive Throttle returning all items added within the TimeSpan

Given an IObservable is there a way to use Throttle behaviour (reset a timer when an item is added, but have it return a collection of all the items added within that time? Buffer provides a similar functionality it that it chunks the data up…
RichK
  • 11,318
  • 6
  • 35
  • 49
10
votes
3 answers

Equivalent of RxJS switchMap in ReactiveX/Rx.NET

In RxJS, there is a switchMap function. Is there an equivalent in ReactiveX/Rx.NET? I don't see one in the transforming documentation.
wonderful world
  • 10,969
  • 20
  • 97
  • 194
9
votes
4 answers

Using AsObservable to observe TPL Dataflow blocks without consuming messages

I have a chain of TPL Dataflow blocks and would like to observe progress somewhere inside the system. I am aware that I could just jam a TransformBlock into the mesh where I want to observe, get it to post to a progress updater of some variety and…
theStrawMan
  • 235
  • 2
  • 9
8
votes
2 answers

Rx.Net Message Parser

I'm trying to parse an incoming stream of bytes that represents messages. I need to split the stream and create a message structure for each part. A message always starts with a 0x81 (BOM) and ends with a 0x82 (EOM). start: 0x81 header: 3…
Omer Mor
  • 5,216
  • 2
  • 34
  • 39
8
votes
4 answers

What's a good way to run periodic tasks using Rx, with a single concurrent execution restriction?

I want to run periodic tasks in with a restriction that at most only one execution of a method is running at any given time. I was experimenting with Rx, but I am not sure how to impose at most once concurrency restriction. var timer =…
smartnut007
  • 6,324
  • 6
  • 45
  • 52
7
votes
1 answer

Is there an example of Ix.NET (System.Interactive) somewhere?

I have an async method, say: public async Task GetAsync() { } and would be called from: public async Task> GetAllAsync() { foreach (var item in something) { var result = await GetAsync(); yield return…
nawfal
  • 70,104
  • 56
  • 326
  • 368
7
votes
4 answers

How to use Rx.Nex extension ForEachAsync with async action

I have code which streams data down from SQL and writes it to a different store. The code is approximately this: using (var cmd = new SqlCommand("select * from MyTable", connection)) { using (var reader = await cmd.ExecuteReaderAsync()) { …
Mark Shamis
  • 353
  • 1
  • 3
  • 6
7
votes
5 answers

Unwrapping IObservable> into IObservable with order preservation

Is there a way to unwrap the IObservable> into IObservable keeping the same order of events, like this? Tasks: ----a-------b--c----------d------e---f----> Values: -------A-----------B--C------D-----E---F--> Let's say I have a desktop…
yallie
  • 2,200
  • 1
  • 28
  • 26
1
2 3
17 18