What are the default Schedulers for each observable operator?

后端 未结 1 706
野趣味
野趣味 2020-11-29 18:38

This page on MSDN states that

If you do not use the overload which takes a scheduler as an argument, Rx will pick a default scheduler by using the pri

相关标签:
1条回答
  • 2020-11-29 19:04

    Wow, that was not trivial to find...

    Deep within the bowels of the System.Reactive.Concurrency namespace, there is an internal static class called SchedulerDefaults, which is declared as:

    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; }}
    }
    

    AsyncConversions is used by:

    Start, ToAsync, FromAsyncPattern
    

    ConstantTimeOperations is used by:

    Empty, GetSchedulerForCurrentContext, Return, StartWith, Throw
    

    Iteration is used by:

    Generate, Range, Repeat, TakeLast, ToObservable, and the ReplaySubject<T>
    

    TailRecursion is used by:

    Run
    

    TimeBasedOperations is used by:

    Buffer, Delay, DelaySubscription, Generate, Interval, Sample, Skip, SkipLast
    SkipUntil, Take, TakeLast, TakeLastBuffer, TakeUntil, Throttle, TimeInterval,
    Timeout, Timer, Timestamp, Window
    
    0 讨论(0)
提交回复
热议问题