每个可观察运营商的默认调度程序是什么?

Ale*_*ill 39 c# system.reactive

MSDN上的这个页面说明了这一点

如果不使用以调度程序作为参数的重载,Rx将使用最小并发原则选择默认调度程序.这意味着选择引入满足运算符需求的最少并发性的调度程序.例如,对于返回具有有限和少量消息的observable的运算符,Rx调用Immediate.对于返回潜在大量或无限数量消息的运算符,将调用CurrentThread.对于使用计时器的操作员,使用ThreadPool.

我想实际上有一个参考表,可观察的操作员使用哪个默认的Scheduler,但我找不到任何地方.每个可观察运营商的默认调度程序是什么?

Jer*_*all 60

哇,这不是一件容易的事情......

System.Reactive.Concurrency命名空间的内部深处,有一个内部静态类SchedulerDefaults,它被声明为:

internal static class SchedulerDefaults
{
    internal static IScheduler AsyncConversions 
    { get { return DefaultScheduler.Instance; }}

    internal static IScheduler ConstantTimeOperations 
    { get { return ImmediateScheduler.Instance; }}

    internal static IScheduler Iteration 
    { get { return CurrentThreadScheduler.Instance; }}

    internal static IScheduler TailRecursion 
    { get { return ImmediateScheduler.Instance; }}

    internal static IScheduler TimeBasedOperations 
    { get { return DefaultScheduler.Instance; }}
}
Run Code Online (Sandbox Code Playgroud)

AsyncConversions 用于:

Start, ToAsync, FromAsyncPattern
Run Code Online (Sandbox Code Playgroud)

ConstantTimeOperations 用于:

Empty, GetSchedulerForCurrentContext, Return, StartWith, Throw
Run Code Online (Sandbox Code Playgroud)

Iteration 用于:

Generate, Range, Repeat, TakeLast, ToObservable, and the ReplaySubject<T>
Run Code Online (Sandbox Code Playgroud)

TailRecursion 用于:

Run
Run Code Online (Sandbox Code Playgroud)

TimeBasedOperations 用于:

Buffer, Delay, DelaySubscription, Generate, Interval, Sample, Skip, SkipLast
SkipUntil, Take, TakeLast, TakeLastBuffer, TakeUntil, Throttle, TimeInterval,
Timeout, Timer, Timestamp, Window
Run Code Online (Sandbox Code Playgroud)