I'm trying to get started with Reactive Extensions (Rx). Here's a little example I cooked up:
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 obsolete: 'This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.
If I follow the warning's instructions I still get the warning. What am I expected to use for the scheduler exactly, if I want to use the various options that used to be available via the Scheduler
class?
Most Schedulers should come with a default instance. You should be able to use NewThreadScheduler.Default
, ThreadPoolScheduler.Instance
, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With