Rx Scheduler options are outdated

I am trying to get started with Reactive Extensions (Rx). Here is a small example that I prepared:

var query = from number in Enumerable.Range(1, 20) select number; var obs = query.ToObservable(Scheduler.ThreadPool); obs.Subscribe(Console.WriteLine); Console.ReadLine(); 

When I use Scheduler.ThreadPool , Scheduler.NewThread , etc., I get this warning:

System.Reactive.Concurrency.Scheduler.ThreadPool 'is deprecated: "This property is no longer supported due to refactoring of the API surface and elimination of platform dependencies. Think using Scheduler.Default to get the platform that is most suitable for the pool-based scheduler. To get access to a specific pool-based scheduler, add a reference to the System.Reactive.PlatformServices assembly for the target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. For more details see http://go.microsoft.com/fwlink/?LinkID = 260866 .

If I follow the warning instructions, I still get a warning. What should I use for the scheduler exactly if I want to use various parameters that were previously available through the Scheduler class?

+6
source share
1 answer

Most schedulers should have a default instance. You should be able to use NewThreadScheduler.Default , ThreadPoolScheduler.Instance , etc.

+9
source

All Articles