From 880486b0128d345b219d2bb2745c656a5aca2b3f Mon Sep 17 00:00:00 2001 From: akarnokd Date: Sat, 30 Jun 2018 00:43:22 +0200 Subject: [PATCH 1/3] 4.x: System.Reactive fix field names, type args, usings, operator infrastructure --- .../System.Reactive/AnonymousSafeObserver.cs | 8 +- .../System.Reactive/Concurrency/AsyncLock.cs | 38 +- ...ConcurrencyAbstractionLayerImpl.Windows.cs | 1 - .../ConcurrencyAbstractionLayerImpl.cs | 7 +- .../Concurrency/CurrentThreadScheduler.cs | 32 +- .../Concurrency/DefaultScheduler.cs | 16 +- .../Concurrency/EventLoopScheduler.cs | 4 +- .../Concurrency/HistoricalScheduler.cs | 12 +- .../Concurrency/ImmediateScheduler.cs | 18 +- .../Concurrency/LocalScheduler.TimerQueue.cs | 40 +- .../Concurrency/Scheduler.Async.cs | 4 +- .../Concurrency/Scheduler.Recursive.cs | 58 +- .../System.Reactive/Concurrency/Scheduler.cs | 12 +- .../Concurrency/Synchronization.cs | 10 +- .../Concurrency/TaskPoolScheduler.cs | 2 +- .../ThreadPoolScheduler.Windows.cs | 2 +- .../Concurrency/ThreadPoolScheduler.cs | 3 +- .../Concurrency/VirtualTimeScheduler.cs | 18 +- .../Disposables/CompositeDisposable.cs | 20 +- .../Internal/ExceptionServices.cs | 6 +- .../Internal/HostLifecycleService.cs | 6 +- .../System.Reactive/Internal/ImmutableList.cs | 2 +- .../Internal/PlatformEnlightenmentProvider.cs | 6 +- .../System.Reactive/Internal/QueryServices.cs | 4 +- .../Internal/ReflectionUtils.cs | 4 +- .../Internal/ScheduledObserver.cs | 78 +- .../System.Reactive/Internal/SystemClock.cs | 40 +- .../src/System.Reactive/Joins/ActivePlan.cs | 1297 ++++++++--------- .../Linq/Observable.Aggregates.cs | 104 +- .../Linq/Observable.Awaiter.cs | 8 +- .../Linq/Observable.Creation.cs | 4 +- .../Linq/Observable.Queryable.cs | 4 +- .../System.Reactive/Linq/Observable/Amb.cs | 96 +- .../Linq/Observable/AmbMany.cs | 113 +- .../Linq/Observable/AutoConnect.cs | 24 +- .../System.Reactive/Linq/Observable/Buffer.cs | 6 +- .../System.Reactive/Linq/Observable/Case.cs | 2 +- .../Linq/Observable/ConcatMany.cs | 102 +- .../System.Reactive/Linq/Observable/Defer.cs | 2 +- .../Linq/Observable/FirstLastBlocking.cs | 4 +- .../Linq/Observable/Multicast.cs | 2 +- .../Linq/Observable/RefCount.cs | 2 +- .../System.Reactive/Linq/Observable/Repeat.cs | 8 +- .../Linq/Observable/RepeatWhen.cs | 72 +- .../Linq/Observable/RetryWhen.cs | 116 +- .../Linq/Observable/SkipUntil.cs | 4 +- .../System.Reactive/Linq/Observable/Take.cs | 2 +- .../Linq/Observable/TakeLast.cs | 12 +- .../Linq/Observable/TakeLastBuffer.cs | 2 +- .../Linq/Observable/TakeUntil.cs | 4 +- .../Linq/Observable/TimeInterval.cs | 8 +- .../Linq/Observable/ToObservable.cs | 5 +- .../System.Reactive/Linq/Observable/Using.cs | 2 +- .../System.Reactive/Linq/Observable/Zip.cs | 2 +- .../src/System.Reactive/Linq/ObservableEx.cs | 2 + .../src/System.Reactive/Linq/Observable_.cs | 2 + .../Linq/Qbservable.Generated.cs | 4 +- .../System.Reactive/Linq/Qbservable.Joins.cs | 20 +- .../src/System.Reactive/Linq/Qbservable.cs | 8 +- .../Linq/QbservableEx.Generated.cs | 4 +- .../Linq/QueryLanguage.Creation.cs | 66 +- .../src/System.Reactive/ListObservable.cs | 40 +- .../src/System.Reactive/Notification.cs | 4 +- .../src/System.Reactive/ObservableQuery.cs | 8 +- .../src/System.Reactive/ObserverBase.cs | 14 +- .../Desktop/Concurrency/ControlScheduler.cs | 6 +- .../Concurrency/DispatcherScheduler.cs | 34 +- .../Desktop/Linq/ControlObservable.cs | 2 +- .../Desktop/Linq/DispatcherObservable.cs | 28 +- .../Desktop/Linq/Observable.Remoting.cs | 16 +- .../Desktop/Linq/QueryLanguage.Remoting.cs | 34 +- .../Concurrency/CoreDispatcherScheduler.cs | 2 +- .../UWP/Linq/WindowsObservable.Events.cs | 6 +- .../System.Reactive/Subjects/AsyncSubject.cs | 20 +- .../src/System.Reactive/TimeInterval.cs | 2 +- .../Source/src/System.Reactive/Timestamped.cs | 2 +- 76 files changed, 1372 insertions(+), 1410 deletions(-) diff --git a/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs b/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs index 10abcc0e5a..ceefd7213d 100644 --- a/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs +++ b/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs @@ -24,7 +24,7 @@ internal sealed class AnonymousSafeObserver : SafeObserver private readonly Action _onError; private readonly Action _onCompleted; - private int isStopped; + private int _isStopped; public AnonymousSafeObserver(Action onNext, Action onError, Action onCompleted) { @@ -35,7 +35,7 @@ public AnonymousSafeObserver(Action onNext, Action onError, Action public override void OnNext(T value) { - if (isStopped == 0) + if (_isStopped == 0) { var __noError = false; try @@ -55,7 +55,7 @@ public override void OnNext(T value) public override void OnError(Exception error) { - if (Interlocked.Exchange(ref isStopped, 1) == 0) + if (Interlocked.Exchange(ref _isStopped, 1) == 0) { using (this) { @@ -66,7 +66,7 @@ public override void OnError(Exception error) public override void OnCompleted() { - if (Interlocked.Exchange(ref isStopped, 1) == 0) + if (Interlocked.Exchange(ref _isStopped, 1) == 0) { using (this) { diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs index c4ed183861..2c9ce90771 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs @@ -11,10 +11,10 @@ namespace System.Reactive.Concurrency /// public sealed class AsyncLock : IDisposable { - private bool isAcquired; - private bool hasFaulted; - private readonly object guard = new object(); - private Queue<(Action action, Delegate @delegate, object state)> queue; + private bool _isAcquired; + private bool _hasFaulted; + private readonly object _guard = new object(); + private Queue<(Action action, Delegate @delegate, object state)> _queue; /// /// Queues the action for execution. If the caller acquires the lock and becomes the owner, @@ -56,24 +56,24 @@ internal void Wait(TState state, Action action) private void Wait(object state, Delegate @delegate, Action action) { // allow one thread to update the state - lock (guard) + lock (_guard) { // if a previous action crashed, ignore any future actions - if (hasFaulted) + if (_hasFaulted) { return; } // if the "lock" is busy, queue up the extra work // otherwise there is no need to queue up "action" - if (isAcquired) + if (_isAcquired) { // create the queue if necessary - var q = queue; + var q = _queue; if (q == null) { q = new Queue<(Action action, Delegate @delegate, object state)>(); - queue = q; + _queue = q; } // enqueue the work q.Enqueue((action, @delegate, state)); @@ -81,7 +81,7 @@ private void Wait(object state, Delegate @delegate, Action act } // indicate there is processing going on - isAcquired = true; + _isAcquired = true; } // if we get here, execute the "action" first @@ -95,25 +95,25 @@ private void Wait(object state, Delegate @delegate, Action act catch { // the execution failed, terminate this AsyncLock - lock (guard) + lock (_guard) { // throw away the queue - queue = null; + _queue = null; // report fault - hasFaulted = true; + _hasFaulted = true; } throw; } // execution succeeded, let's see if more work has to be done - lock (guard) + lock (_guard) { - var q = queue; + var q = _queue; // either there is no queue yet or we run out of work if (q == null || q.Count == 0) { // release the lock - isAcquired = false; + _isAcquired = false; return; } @@ -129,10 +129,10 @@ private void Wait(object state, Delegate @delegate, Action act /// public void Dispose() { - lock (guard) + lock (_guard) { - queue = null; - hasFaulted = true; + _queue = null; + _hasFaulted = true; } } } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs index 4c228e6ab8..120e10358c 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. #if NO_THREAD && WINDOWS -using System.Reactive.Disposables; using System.Threading; namespace System.Reactive.Concurrency diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs index af37d2b79e..142d973841 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. #if !NO_THREAD -using System.Collections.Generic; using System.Reactive.Disposables; using System.Threading; @@ -236,7 +235,7 @@ public void Dispose() private sealed class FastPeriodicTimer : IDisposable { private readonly Action _action; - private volatile bool disposed; + private volatile bool _disposed; public FastPeriodicTimer(Action action) { @@ -254,7 +253,7 @@ private static void Loop(object threadParam) { var timer = (FastPeriodicTimer)threadParam; - while (!timer.disposed) + while (!timer._disposed) { timer._action(); } @@ -262,7 +261,7 @@ private static void Loop(object threadParam) public void Dispose() { - disposed = true; + _disposed = true; } } } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs index 452bf3afa5..a23d8413b0 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/CurrentThreadScheduler.cs @@ -12,7 +12,7 @@ namespace System.Reactive.Concurrency /// Singleton instance of this type exposed through this static property. public sealed class CurrentThreadScheduler : LocalScheduler { - private static readonly Lazy s_instance = new Lazy(() => new CurrentThreadScheduler()); + private static readonly Lazy _staticInstance = new Lazy(() => new CurrentThreadScheduler()); private CurrentThreadScheduler() { @@ -21,34 +21,34 @@ private CurrentThreadScheduler() /// /// Gets the singleton instance of the current thread scheduler. /// - public static CurrentThreadScheduler Instance => s_instance.Value; + public static CurrentThreadScheduler Instance => _staticInstance.Value; [ThreadStatic] - private static SchedulerQueue s_threadLocalQueue; + private static SchedulerQueue _threadLocalQueue; [ThreadStatic] - private static IStopwatch s_clock; + private static IStopwatch _clock; [ThreadStatic] - private static bool running; + private static bool _running; - private static SchedulerQueue GetQueue() => s_threadLocalQueue; + private static SchedulerQueue GetQueue() => _threadLocalQueue; private static void SetQueue(SchedulerQueue newQueue) { - s_threadLocalQueue = newQueue; + _threadLocalQueue = newQueue; } private static TimeSpan Time { get { - if (s_clock == null) + if (_clock == null) { - s_clock = ConcurrencyAbstractionLayer.Current.StartStopwatch(); + _clock = ConcurrencyAbstractionLayer.Current.StartStopwatch(); } - return s_clock.Elapsed; + return _clock.Elapsed; } } @@ -64,7 +64,7 @@ private static TimeSpan Time /// Gets a value that indicates whether the caller must call a Schedule method. /// [EditorBrowsable(EditorBrowsableState.Advanced)] - public static bool IsScheduleRequired => !running; + public static bool IsScheduleRequired => !_running; /// /// Schedules an action to be executed after dueTime. @@ -85,9 +85,9 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun var queue = default(SchedulerQueue); // There is no timed task and no task is currently running - if (!running) + if (!_running) { - running = true; + _running = true; if (dueTime > TimeSpan.Zero) { @@ -103,7 +103,7 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun catch { SetQueue(null); - running = false; + _running = false; throw; } @@ -120,12 +120,12 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun finally { SetQueue(null); - running = false; + _running = false; } } else { - running = false; + _running = false; } return d; diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs index db575500df..5925a369ab 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs @@ -12,13 +12,13 @@ namespace System.Reactive.Concurrency /// Singleton instance of this type exposed through this static property. public sealed class DefaultScheduler : LocalScheduler, ISchedulerPeriodic { - private static readonly Lazy s_instance = new Lazy(() => new DefaultScheduler()); - private static IConcurrencyAbstractionLayer s_cal = ConcurrencyAbstractionLayer.Current; + private static readonly Lazy _instance = new Lazy(() => new DefaultScheduler()); + private static IConcurrencyAbstractionLayer _cal = ConcurrencyAbstractionLayer.Current; /// /// Gets the singleton instance of the default scheduler. /// - public static DefaultScheduler Instance => s_instance.Value; + public static DefaultScheduler Instance => _instance.Value; private DefaultScheduler() { @@ -41,7 +41,7 @@ public override IDisposable Schedule(TState state, Func(this, state, action); - workItem.CancelQueueDisposable = s_cal.QueueUserWorkItem( + workItem.CancelQueueDisposable = _cal.QueueUserWorkItem( closureWorkItem => ((UserWorkItem)closureWorkItem).Run(), workItem); @@ -72,7 +72,7 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun var workItem = new UserWorkItem(this, state, action); - workItem.CancelQueueDisposable = s_cal.StartTimer( + workItem.CancelQueueDisposable = _cal.StartTimer( closureWorkItem => ((UserWorkItem)closureWorkItem).Run(), workItem, dt); @@ -117,7 +117,7 @@ public PeriodicallyScheduledWorkItem(TState state, TimeSpan period, Func action) _state = state; _action = action; - s_cal.StartThread( + _cal.StartThread( @thisObject => { var @this = (LongScheduledWorkItem)@thisObject; diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/EventLoopScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/EventLoopScheduler.cs index 85826edc64..e7457e7df4 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/EventLoopScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/EventLoopScheduler.cs @@ -18,7 +18,7 @@ public sealed class EventLoopScheduler : LocalScheduler, ISchedulerPeriodic, IDi /// /// Counter for diagnostic purposes, to name the threads. /// - private static int s_counter; + private static int _counter; /// /// Thread factory function. @@ -82,7 +82,7 @@ public sealed class EventLoopScheduler : LocalScheduler, ISchedulerPeriodic, IDi /// Creates an object that schedules units of work on a designated thread. /// public EventLoopScheduler() - : this(a => new Thread(a) { Name = "Event Loop " + Interlocked.Increment(ref s_counter), IsBackground = true }) + : this(a => new Thread(a) { Name = "Event Loop " + Interlocked.Increment(ref _counter), IsBackground = true }) { } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs index 2bd0440c03..7d447adc49 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs @@ -69,7 +69,7 @@ protected override DateTimeOffset Add(DateTimeOffset absolute, TimeSpan relative /// public class HistoricalScheduler : HistoricalSchedulerBase { - private readonly SchedulerQueue queue = new SchedulerQueue(); + private readonly SchedulerQueue _queue = new SchedulerQueue(); /// /// Creates a new historical scheduler with the minimum value of as the initial clock value. @@ -105,13 +105,13 @@ public HistoricalScheduler(DateTimeOffset initialClock, IComparerThe next scheduled item. protected override IScheduledItem GetNext() { - while (queue.Count > 0) + while (_queue.Count > 0) { - var next = queue.Peek(); + var next = _queue.Peek(); if (next.IsCanceled) { - queue.Dequeue(); + _queue.Dequeue(); } else { @@ -142,12 +142,12 @@ public override IDisposable ScheduleAbsolute(TState state, DateTimeOffse var run = new Func((scheduler, state1) => { - queue.Remove(si); + _queue.Remove(si); return action(scheduler, state1); }); si = new ScheduledItem(this, state, run, dueTime, Comparer); - queue.Enqueue(si); + _queue.Enqueue(si); return si; } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/ImmediateScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/ImmediateScheduler.cs index 27e3dba065..09fc61232a 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/ImmediateScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/ImmediateScheduler.cs @@ -12,7 +12,7 @@ namespace System.Reactive.Concurrency /// Singleton instance of this type exposed through this static property. public sealed class ImmediateScheduler : LocalScheduler { - private static readonly Lazy s_instance = new Lazy(() => new ImmediateScheduler()); + private static readonly Lazy _instance = new Lazy(() => new ImmediateScheduler()); private ImmediateScheduler() { @@ -21,7 +21,7 @@ private ImmediateScheduler() /// /// Gets the singleton instance of the immediate scheduler. /// - public static ImmediateScheduler Instance => s_instance.Value; + public static ImmediateScheduler Instance => _instance.Value; /// /// Schedules an action to be executed. @@ -68,7 +68,7 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun private sealed class AsyncLockScheduler : LocalScheduler { - private AsyncLock asyncLock; + private AsyncLock _asyncLock; public override IDisposable Schedule(TState state, Func action) { @@ -79,12 +79,12 @@ public override IDisposable Schedule(TState state, Func { @@ -118,12 +118,12 @@ private IDisposable ScheduleSlow(TState state, TimeSpan dueTime, Func { diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs index 3a90e9f637..bbec02d7f1 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/LocalScheduler.TimerQueue.cs @@ -20,20 +20,20 @@ public partial class LocalScheduler /// Gate to protect queues and to synchronize scheduling decisions and system clock /// change management. /// - private static readonly object s_gate = new object(); + private static readonly object _staticGate = new object(); /// /// Long term work queue. Contains work that's due beyond SHORTTERM, computed at the /// time of enqueueing. /// - private static readonly PriorityQueue s_longTerm = new PriorityQueue(); + private static readonly PriorityQueue _longTerm = new PriorityQueue(); /// /// Disposable resource for the long term timer that will reevaluate and dispatch the /// first item in the long term queue. A serial disposable is used to make "dispose /// current and assign new" logic easier. The disposable itself is never disposed. /// - private static readonly SerialDisposable s_nextLongTermTimer = new SerialDisposable(); + private static readonly SerialDisposable _nextLongTermTimer = new SerialDisposable(); /// /// Item at the head of the long term queue for which the current long term timer is @@ -41,7 +41,7 @@ public partial class LocalScheduler /// or can continue using the current timer (because no earlier long term work was /// added to the queue). /// - private static WorkItem s_nextLongTermWorkItem; + private static WorkItem _nextLongTermWorkItem; /// /// Short term work queue. Contains work that's due soon, computed at the time of @@ -137,7 +137,7 @@ private IDisposable Enqueue(TState state, DateTimeOffset dueTime, Func(state, TimeSpan.Zero, action); + return Schedule(state, TimeSpan.Zero, action); } // @@ -277,9 +277,9 @@ private IDisposable ExecuteNextShortTermWorkItem(IScheduler scheduler, IDisposab /// Work item to schedule on the long term. The caller is responsible to determine the work is indeed long term. private static void ScheduleLongTermWork(WorkItem/*!*/ item) { - lock (s_gate) + lock (_staticGate) { - s_longTerm.Enqueue(item); + _longTerm.Enqueue(item); // // In case we're the first long-term item in the queue now, the timer will have @@ -301,7 +301,7 @@ private static void UpdateLongTermProcessingTimer() * lock (s_gate) */ { - if (s_longTerm.Count == 0) + if (_longTerm.Count == 0) { return; } @@ -310,8 +310,8 @@ private static void UpdateLongTermProcessingTimer() // To avoid setting the timer all over again for the first work item if it hasn't changed, // we keep track of the next long term work item that will be processed by the timer. // - var next = s_longTerm.Peek(); - if (next == s_nextLongTermWorkItem) + var next = _longTerm.Peek(); + if (next == _nextLongTermWorkItem) { return; } @@ -332,8 +332,8 @@ private static void UpdateLongTermProcessingTimer() // var dueCapped = TimeSpan.FromTicks(Math.Min(dueEarly.Ticks, MAXSUPPORTEDTIMER.Ticks)); - s_nextLongTermWorkItem = next; - s_nextLongTermTimer.Disposable = ConcurrencyAbstractionLayer.Current.StartTimer(_ => EvaluateLongTermQueue(_), null, dueCapped); + _nextLongTermWorkItem = next; + _nextLongTermTimer.Disposable = ConcurrencyAbstractionLayer.Current.StartTimer(_ => EvaluateLongTermQueue(_), null, dueCapped); } } @@ -344,13 +344,13 @@ private static void UpdateLongTermProcessingTimer() /// Ignored. private static void EvaluateLongTermQueue(object state) { - lock (s_gate) + lock (_staticGate) { var next = default(WorkItem); - while (s_longTerm.Count > 0) + while (_longTerm.Count > 0) { - next = s_longTerm.Peek(); + next = _longTerm.Peek(); var due = Scheduler.Normalize(next.DueTime - next.Scheduler.Now); if (due >= SHORTTERM) @@ -358,11 +358,11 @@ private static void EvaluateLongTermQueue(object state) break; } - var item = s_longTerm.Dequeue(); + var item = _longTerm.Dequeue(); item.Scheduler.ScheduleShortTermWork(item); } - s_nextLongTermWorkItem = null; + _nextLongTermWorkItem = null; UpdateLongTermProcessingTimer(); } } @@ -375,7 +375,7 @@ private static void EvaluateLongTermQueue(object state) /// Currently not used. internal void SystemClockChanged(object sender, SystemClockChangedEventArgs args) { - lock (s_gate) + lock (_staticGate) { lock (_gate) { @@ -400,14 +400,14 @@ internal void SystemClockChanged(object sender, SystemClockChangedEventArgs args while (_shortTerm.Count > 0) { var next = _shortTerm.Dequeue(); - s_longTerm.Enqueue(next); + _longTerm.Enqueue(next); } // // Reevaluate the queue and don't forget to null out the current timer to force the // method to create a new timer for the new first long term item. // - s_nextLongTermWorkItem = null; + _nextLongTermWorkItem = null; EvaluateLongTermQueue(null); } } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Async.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Async.cs index 3a6fa7ea70..0547cceea5 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Async.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Async.cs @@ -140,7 +140,7 @@ public static IDisposable ScheduleAsync(this IScheduler scheduler, TStat throw new ArgumentNullException(nameof(action)); } - return ScheduleAsync_(scheduler, state, action); + return ScheduleAsync_(scheduler, state, action); } /// @@ -164,7 +164,7 @@ public static IDisposable ScheduleAsync(this IScheduler scheduler, TStat throw new ArgumentNullException(nameof(action)); } - return ScheduleAsync_(scheduler, state, action); + return ScheduleAsync_(scheduler, state, action); } /// diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs index 24d343429d..166549c69b 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs @@ -173,41 +173,41 @@ private static IDisposable InvokeRec3(IScheduler scheduler, (TState stat private abstract class InvokeRecBaseState : IDisposable { - protected readonly IScheduler scheduler; + protected readonly IScheduler Scheduler; - protected readonly CompositeDisposable group; + protected readonly CompositeDisposable Group; public InvokeRecBaseState(IScheduler scheduler) { - this.scheduler = scheduler; - group = new CompositeDisposable(); + Scheduler = scheduler; + Group = new CompositeDisposable(); } public void Dispose() { - group.Dispose(); + Group.Dispose(); } } private sealed class InvokeRec1State : InvokeRecBaseState { - private readonly Action> action; - private readonly Action recurseCallback; + private readonly Action> _action; + private readonly Action _recurseCallback; public InvokeRec1State(IScheduler scheduler, Action> action) : base(scheduler) { - this.action = action; - recurseCallback = state => InvokeNext(state); + _action = action; + _recurseCallback = state => InvokeNext(state); } internal void InvokeNext(TState state) { var sad = new SingleAssignmentDisposable(); - group.Add(sad); - sad.Disposable = scheduler.Schedule((state, sad, @this: this), (_, nextState) => + Group.Add(sad); + sad.Disposable = Scheduler.Schedule((state, sad, @this: this), (_, nextState) => { - nextState.@this.group.Remove(nextState.sad); + nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); return Disposable.Empty; }); @@ -215,28 +215,28 @@ internal void InvokeNext(TState state) internal void InvokeFirst(TState state) { - action(state, recurseCallback); + _action(state, _recurseCallback); } } private sealed class InvokeRec2State : InvokeRecBaseState { - private readonly Action> action; - private readonly Action recurseCallback; + private readonly Action> _action; + private readonly Action _recurseCallback; public InvokeRec2State(IScheduler scheduler, Action> action) : base(scheduler) { - this.action = action; - recurseCallback = (state, time) => InvokeNext(state, time); + _action = action; + _recurseCallback = (state, time) => InvokeNext(state, time); } internal void InvokeNext(TState state, TimeSpan time) { var sad = new SingleAssignmentDisposable(); - group.Add(sad); - sad.Disposable = scheduler.Schedule((state, sad, @this: this), time, (_, nextState) => + Group.Add(sad); + sad.Disposable = Scheduler.Schedule((state, sad, @this: this), time, (_, nextState) => { - nextState.@this.group.Remove(nextState.sad); + nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); return Disposable.Empty; }); @@ -244,28 +244,28 @@ internal void InvokeNext(TState state, TimeSpan time) internal void InvokeFirst(TState state) { - action(state, recurseCallback); + _action(state, _recurseCallback); } } private sealed class InvokeRec3State : InvokeRecBaseState { - private readonly Action> action; - private readonly Action recurseCallback; + private readonly Action> _action; + private readonly Action _recurseCallback; public InvokeRec3State(IScheduler scheduler, Action> action) : base(scheduler) { - this.action = action; - recurseCallback = (state, dtOffset) => InvokeNext(state, dtOffset); + _action = action; + _recurseCallback = (state, dtOffset) => InvokeNext(state, dtOffset); } internal void InvokeNext(TState state, DateTimeOffset dtOffset) { var sad = new SingleAssignmentDisposable(); - group.Add(sad); - sad.Disposable = scheduler.Schedule((state, sad, @this: this), dtOffset, (_, nextState) => + Group.Add(sad); + sad.Disposable = Scheduler.Schedule((state, sad, @this: this), dtOffset, (_, nextState) => { - nextState.@this.group.Remove(nextState.sad); + nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); return Disposable.Empty; }); @@ -273,7 +273,7 @@ internal void InvokeNext(TState state, DateTimeOffset dtOffset) internal void InvokeFirst(TState state) { - action(state, recurseCallback); + _action(state, _recurseCallback); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs index 4077118f9b..a7e0a2e180 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.cs @@ -60,29 +60,29 @@ public static partial class Scheduler // - private static Lazy s_threadPool = new Lazy(() => Initialize("ThreadPool")); + private static Lazy _threadPool = new Lazy(() => Initialize("ThreadPool")); /// /// Gets a scheduler that schedules work on the thread pool. /// [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_THREADPOOL)] - public static IScheduler ThreadPool => s_threadPool.Value; + public static IScheduler ThreadPool => _threadPool.Value; - private static Lazy s_newThread = new Lazy(() => Initialize("NewThread")); + private static Lazy _newThread = new Lazy(() => Initialize("NewThread")); /// /// Gets a scheduler that schedules work on a new thread using default thread creation options. /// [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_NEWTHREAD)] - public static IScheduler NewThread => s_newThread.Value; + public static IScheduler NewThread => _newThread.Value; - private static Lazy s_taskPool = new Lazy(() => Initialize("TaskPool")); + private static Lazy _taskPool = new Lazy(() => Initialize("TaskPool")); /// /// Gets a scheduler that schedules work on Task Parallel Library (TPL) task pool using the default TaskScheduler. /// [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_TASKPOOL)] - public static IScheduler TaskPool => s_taskPool.Value; + public static IScheduler TaskPool => _taskPool.Value; private static IScheduler Initialize(string name) { diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs index 86eec1bad0..0d22a02e59 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.cs @@ -68,18 +68,18 @@ public void Dispose() } } - private readonly IObservable source; - private readonly IScheduler scheduler; + private readonly IObservable _source; + private readonly IScheduler _scheduler; public SubscribeOnObservable(IObservable source, IScheduler scheduler) { - this.source = source; - this.scheduler = scheduler; + _source = source; + _scheduler = scheduler; } protected override IDisposable SubscribeCore(IObserver observer) { - return new Subscription(source, scheduler, observer); + return new Subscription(_source, _scheduler, observer); } } diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/TaskPoolScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/TaskPoolScheduler.cs index 210f6a25c0..8ddb2859cf 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/TaskPoolScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/TaskPoolScheduler.cs @@ -11,7 +11,7 @@ namespace System.Reactive.Concurrency /// /// Represents an object that schedules units of work on the Task Parallel Library (TPL) task pool. /// - /// Instance of this type using the default TaskScheduler to schedule work on the TPL task pool. + /// Instance of this type using the default TaskScheduler to schedule work on the TPL task pool. public sealed class TaskPoolScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic { private sealed class ScheduledWorkItem : IDisposable diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs index 0aaead1811..8109552682 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.Windows.cs @@ -11,7 +11,7 @@ namespace System.Reactive.Concurrency /// /// Represents an object that schedules units of work on the Windows Runtime thread pool. /// - /// Singleton instance of this type exposed through this static property. + /// Singleton instance of this type exposed through this static property. [CLSCompliant(false)] public sealed class ThreadPoolScheduler : LocalScheduler, ISchedulerPeriodic { diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs index 29312328e7..4470aeee78 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. #if !WINDOWS && !NO_THREAD -using System.Collections.Generic; using System.Reactive.Disposables; using System.Threading; @@ -12,7 +11,7 @@ namespace System.Reactive.Concurrency /// /// Represents an object that schedules units of work on the CLR thread pool. /// - /// Singleton instance of this type exposed through this static property. + /// Singleton instance of this type exposed through this static property. public sealed class ThreadPoolScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic { private static readonly Lazy LazyInstance = new Lazy(() => new ThreadPoolScheduler()); diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/VirtualTimeScheduler.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/VirtualTimeScheduler.cs index 2f0415e22b..68e91765ad 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/VirtualTimeScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/VirtualTimeScheduler.cs @@ -357,7 +357,7 @@ public VirtualTimeStopwatch(Func getElapsed) public abstract class VirtualTimeScheduler : VirtualTimeSchedulerBase where TAbsolute : IComparable { - private readonly SchedulerQueue queue = new SchedulerQueue(); + private readonly SchedulerQueue _queue = new SchedulerQueue(); /// /// Creates a new virtual time scheduler with the default value of TAbsolute as the initial clock value. @@ -384,14 +384,14 @@ protected VirtualTimeScheduler(TAbsolute initialClock, IComparer comp /// The next scheduled item. protected override IScheduledItem GetNext() { - lock (queue) + lock (_queue) { - while (queue.Count > 0) + while (_queue.Count > 0) { - var next = queue.Peek(); + var next = _queue.Peek(); if (next.IsCanceled) { - queue.Dequeue(); + _queue.Dequeue(); } else { @@ -423,9 +423,9 @@ public override IDisposable ScheduleAbsolute(TState state, TAbsolute due var run = new Func((scheduler, state1) => { - lock (queue) + lock (_queue) { - queue.Remove(si); + _queue.Remove(si); } return action(scheduler, state1); @@ -433,9 +433,9 @@ public override IDisposable ScheduleAbsolute(TState state, TAbsolute due si = new ScheduledItem(this, state, run, dueTime, Comparer); - lock (queue) + lock (_queue) { - queue.Enqueue(si); + _queue.Enqueue(si); } return si; diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs index 064c460e79..a3212708f7 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/CompositeDisposable.cs @@ -388,18 +388,18 @@ public IEnumerator GetEnumerator() /// private sealed class CompositeEnumerator : IEnumerator { - private readonly IDisposable[] disposables; - private int index; + private readonly IDisposable[] _disposables; + private int _index; public CompositeEnumerator(IDisposable[] disposables) { - this.disposables = disposables; - index = -1; + _disposables = disposables; + _index = -1; } - public IDisposable Current => disposables[index]; + public IDisposable Current => _disposables[_index]; - object IEnumerator.Current => disposables[index]; + object IEnumerator.Current => _disposables[_index]; public void Dispose() { @@ -407,17 +407,17 @@ public void Dispose() // beyond the lifecycle of the enumerator. // Not sure if this happens by default to // generic array enumerators though. - var disposables = this.disposables; + var disposables = _disposables; Array.Clear(disposables, 0, disposables.Length); } public bool MoveNext() { - var disposables = this.disposables; + var disposables = _disposables; for (; ; ) { - var idx = ++index; + var idx = ++_index; if (idx >= disposables.Length) { return false; @@ -432,7 +432,7 @@ public bool MoveNext() public void Reset() { - index = -1; + _index = -1; } } } diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs b/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs index a6a9ecf5d3..2d0923c118 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs @@ -9,15 +9,15 @@ namespace System.Reactive { internal static class ExceptionHelpers { - private static Lazy s_services = new Lazy(Initialize); + private static Lazy _services = new Lazy(Initialize); - public static void Throw(this Exception exception) => s_services.Value.Rethrow(exception); + public static void Throw(this Exception exception) => _services.Value.Rethrow(exception); public static void ThrowIfNotNull(this Exception exception) { if (exception != null) { - s_services.Value.Rethrow(exception); + _services.Value.Rethrow(exception); } } diff --git a/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs b/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs index dc484e85ad..0efeb6503f 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs @@ -13,7 +13,7 @@ namespace System.Reactive.PlatformServices [EditorBrowsable(EditorBrowsableState.Never)] public static class HostLifecycleService { - private static Lazy s_notifications = new Lazy(InitializeNotifications); + private static Lazy _notifications = new Lazy(InitializeNotifications); private static int _refCount; @@ -34,7 +34,7 @@ public static void AddRef() { if (Interlocked.Increment(ref _refCount) == 1) { - var notifications = s_notifications.Value; + var notifications = _notifications.Value; if (notifications != null) { notifications.Suspending += OnSuspending; @@ -51,7 +51,7 @@ public static void Release() { if (Interlocked.Decrement(ref _refCount) == 0) { - var notifications = s_notifications.Value; + var notifications = _notifications.Value; if (notifications != null) { notifications.Suspending -= OnSuspending; diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ImmutableList.cs b/Rx.NET/Source/src/System.Reactive/Internal/ImmutableList.cs index 573e8218a0..2cd3db2491 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/ImmutableList.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/ImmutableList.cs @@ -58,7 +58,7 @@ private int IndexOf(T value) { for (var i = 0; i < _data.Length; ++i) { - if (object.Equals(_data[i], value)) + if (Equals(_data[i], value)) { return i; } diff --git a/Rx.NET/Source/src/System.Reactive/Internal/PlatformEnlightenmentProvider.cs b/Rx.NET/Source/src/System.Reactive/Internal/PlatformEnlightenmentProvider.cs index 8123d80b34..a57489628e 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/PlatformEnlightenmentProvider.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/PlatformEnlightenmentProvider.cs @@ -34,7 +34,7 @@ public interface IPlatformEnlightenmentProvider [EditorBrowsable(EditorBrowsableState.Never)] public static class PlatformEnlightenmentProvider { - private static IPlatformEnlightenmentProvider s_current = CreatePlatformProvider(); + private static IPlatformEnlightenmentProvider _current = CreatePlatformProvider(); /// /// (Infrastructure) Gets the current enlightenment provider. If none is loaded yet, accessing this property triggers provider resolution. @@ -47,12 +47,12 @@ public static IPlatformEnlightenmentProvider Current { get { - return s_current; + return _current; } set { - s_current = value ?? throw new ArgumentNullException(nameof(value)); + _current = value ?? throw new ArgumentNullException(nameof(value)); } } diff --git a/Rx.NET/Source/src/System.Reactive/Internal/QueryServices.cs b/Rx.NET/Source/src/System.Reactive/Internal/QueryServices.cs index 7ebca1169d..62d55b303f 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/QueryServices.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/QueryServices.cs @@ -8,9 +8,9 @@ namespace System.Reactive.Linq { internal static class QueryServices { - private static readonly IQueryServices s_services = Initialize(); + private static readonly IQueryServices _services = Initialize(); - public static T GetQueryImpl(T defaultInstance) => s_services.Extend(defaultInstance); + public static T GetQueryImpl(T defaultInstance) => _services.Extend(defaultInstance); private static IQueryServices Initialize() { diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs b/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs index bec9fbcdbc..526672d4f7 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/ReflectionUtils.cs @@ -2,11 +2,13 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; using System.Globalization; using System.Reflection; #if HAS_WINRT +#if CRIPPLED_REFLECTION +using System.Collections.Generic; +#endif using System.Runtime.InteropServices.WindowsRuntime; #endif diff --git a/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs b/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs index b48e578fb4..950caa6f3d 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/ScheduledObserver.cs @@ -383,50 +383,50 @@ internal interface IScheduledObserver : IObserver, IDisposable /// The element type of the sequence. internal sealed class ObserveOnObserverNew : IObserver, IDisposable { - private readonly IObserver downstream; - private readonly IScheduler scheduler; + private readonly IObserver _downstream; + private readonly IScheduler _scheduler; /// - /// If not null, the supports + /// If not null, the supports /// long running tasks. /// - private readonly ISchedulerLongRunning longRunning; - private readonly ConcurrentQueue queue; + private readonly ISchedulerLongRunning _longRunning; + private readonly ConcurrentQueue _queue; private IDisposable _run; /// /// The current task representing a running drain operation. /// - private IDisposable task; + private IDisposable _task; /// /// Indicates the work-in-progress state of this operator, /// zero means no work is currently being done. /// - private int wip; + private int _wip; /// /// If true, the upstream has issued OnCompleted. /// - private bool done; + private bool _done; /// - /// If is true and this is non-null, the upstream + /// If is true and this is non-null, the upstream /// failed with an OnError. /// - private Exception error; + private Exception _error; /// /// Indicates a dispose has been requested. /// - private bool disposed; + private bool _disposed; public ObserveOnObserverNew(IScheduler scheduler, IObserver downstream) { - this.downstream = downstream; - this.scheduler = scheduler; - longRunning = scheduler.AsLongRunning(); - queue = new ConcurrentQueue(); + _downstream = downstream; + _scheduler = scheduler; + _longRunning = scheduler.AsLongRunning(); + _queue = new ConcurrentQueue(); } public void Run(IObservable source) @@ -436,8 +436,8 @@ public void Run(IObservable source) public void Dispose() { - Volatile.Write(ref disposed, true); - Disposable.TryDispose(ref task); + Volatile.Write(ref _disposed, true); + Disposable.TryDispose(ref _task); Disposable.TryDispose(ref _run); Clear(); } @@ -448,7 +448,7 @@ public void Dispose() /// private void Clear() { - var q = queue; + var q = _queue; while (q.TryDequeue(out var _)) { ; @@ -457,20 +457,20 @@ private void Clear() public void OnCompleted() { - Volatile.Write(ref done, true); + Volatile.Write(ref _done, true); Schedule(); } public void OnError(Exception error) { - this.error = error; - Volatile.Write(ref done, true); + _error = error; + Volatile.Write(ref _done, true); Schedule(); } public void OnNext(T value) { - queue.Enqueue(value); + _queue.Enqueue(value); Schedule(); } @@ -480,20 +480,20 @@ public void OnNext(T value) /// private void Schedule() { - if (Interlocked.Increment(ref wip) == 1) + if (Interlocked.Increment(ref _wip) == 1) { var newTask = new SingleAssignmentDisposable(); - if (Disposable.TrySetMultiple(ref task, newTask)) + if (Disposable.TrySetMultiple(ref _task, newTask)) { - var longRunning = this.longRunning; + var longRunning = _longRunning; if (longRunning != null) { newTask.Disposable = longRunning.ScheduleLongRunning(this, DRAIN_LONG_RUNNING); } else { - newTask.Disposable = scheduler.Schedule(this, DRAIN_SHORT_RUNNING); + newTask.Disposable = _scheduler.Schedule(this, DRAIN_SHORT_RUNNING); } } @@ -501,7 +501,7 @@ private void Schedule() // of items. This doesn't have to be inside the // wip != 0 (exclusive) mode as the queue // is of a multi-consumer type. - if (Volatile.Read(ref disposed)) + if (Volatile.Read(ref _disposed)) { Clear(); } @@ -532,9 +532,9 @@ private void Schedule() /// The IDisposable of the recursively scheduled task or an empty disposable. private IDisposable DrainShortRunning(IScheduler recursiveScheduler) { - DrainStep(queue, downstream, false); + DrainStep(_queue, _downstream, false); - if (Interlocked.Decrement(ref wip) != 0) + if (Interlocked.Decrement(ref _wip) != 0) { return recursiveScheduler.Schedule(this, DRAIN_SHORT_RUNNING); } @@ -555,7 +555,7 @@ private IDisposable DrainShortRunning(IScheduler recursiveScheduler) private bool DrainStep(ConcurrentQueue q, IObserver downstream, bool delayError) { // Check if the operator has been disposed - if (Volatile.Read(ref disposed)) + if (Volatile.Read(ref _disposed)) { // cleanup residue items in the queue Clear(); @@ -563,33 +563,33 @@ private bool DrainStep(ConcurrentQueue q, IObserver downstream, bool delay } // Has the upstream call OnCompleted? - var d = Volatile.Read(ref done); + var d = Volatile.Read(ref _done); if (d && !delayError) { // done = true happens before setting error // this is safe to be a plain read - var ex = error; + var ex = _error; // if not null, there was an OnError call if (ex != null) { - Volatile.Write(ref disposed, true); + Volatile.Write(ref _disposed, true); downstream.OnError(ex); return true; } } // get the next item from the queue if any - var empty = !queue.TryDequeue(out var v); + var empty = !_queue.TryDequeue(out var v); // the upstream called OnComplete and the queue is empty // that means we are done, no further signals can happen if (d && empty) { - Volatile.Write(ref disposed, true); + Volatile.Write(ref _disposed, true); // done = true happens before setting error // this is safe to be a plain read - var ex = error; + var ex = _error; // if not null, there was an OnError call if (ex != null) { @@ -627,8 +627,8 @@ private void DrainLongRunning() // read out fields upfront as the DrainStep uses atomics // that would force the re-read of these constant values // from memory, regardless of readonly, afaik - var q = queue; - var downstream = this.downstream; + var q = _queue; + var downstream = _downstream; for (; ; ) { @@ -643,7 +643,7 @@ private void DrainLongRunning() } } - missed = Interlocked.Add(ref wip, -missed); + missed = Interlocked.Add(ref _wip, -missed); if (missed == 0) { break; diff --git a/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.cs b/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.cs index d2cfc7ab19..a1e42b0783 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.cs @@ -19,17 +19,17 @@ namespace System.Reactive.PlatformServices [EditorBrowsable(EditorBrowsableState.Never)] public static class SystemClock { - private static Lazy s_serviceSystemClock = new Lazy(InitializeSystemClock); - private static Lazy s_serviceSystemClockChanged = new Lazy(InitializeSystemClockChanged); - private static readonly HashSet> s_systemClockChanged = new HashSet>(); - private static IDisposable s_systemClockChangedHandlerCollector; + private static Lazy _serviceSystemClock = new Lazy(InitializeSystemClock); + private static Lazy _serviceSystemClockChanged = new Lazy(InitializeSystemClockChanged); + private static readonly HashSet> _systemClockChanged = new HashSet>(); + private static IDisposable _systemClockChangedHandlerCollector; private static int _refCount; /// /// Gets the local system clock time. /// - public static DateTimeOffset UtcNow => s_serviceSystemClock.Value.UtcNow; + public static DateTimeOffset UtcNow => _serviceSystemClock.Value.UtcNow; /// /// Adds a reference to the system clock monitor, causing it to be sending notifications. @@ -39,7 +39,7 @@ public static void AddRef() { if (Interlocked.Increment(ref _refCount) == 1) { - s_serviceSystemClockChanged.Value.SystemClockChanged += OnSystemClockChanged; + _serviceSystemClockChanged.Value.SystemClockChanged += OnSystemClockChanged; } } @@ -51,15 +51,15 @@ public static void Release() { if (Interlocked.Decrement(ref _refCount) == 0) { - s_serviceSystemClockChanged.Value.SystemClockChanged -= OnSystemClockChanged; + _serviceSystemClockChanged.Value.SystemClockChanged -= OnSystemClockChanged; } } private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e) { - lock (s_systemClockChanged) + lock (_systemClockChanged) { - foreach (var entry in s_systemClockChanged) + foreach (var entry in _systemClockChanged) { if (entry.TryGetTarget(out var scheduler)) { @@ -93,15 +93,15 @@ internal static void Register(LocalScheduler scheduler) // can have a lot of instances, so we need to collect spurious handlers // at regular times. // - lock (s_systemClockChanged) + lock (_systemClockChanged) { - s_systemClockChanged.Add(new WeakReference(scheduler)); + _systemClockChanged.Add(new WeakReference(scheduler)); - if (s_systemClockChanged.Count == 1) + if (_systemClockChanged.Count == 1) { - s_systemClockChangedHandlerCollector = ConcurrencyAbstractionLayer.Current.StartPeriodicTimer(CollectHandlers, TimeSpan.FromSeconds(30)); + _systemClockChangedHandlerCollector = ConcurrencyAbstractionLayer.Current.StartPeriodicTimer(CollectHandlers, TimeSpan.FromSeconds(30)); } - else if (s_systemClockChanged.Count % 64 == 0) + else if (_systemClockChanged.Count % 64 == 0) { CollectHandlers(); } @@ -117,11 +117,11 @@ private static void CollectHandlers() // the ConditionalWeakTable type here because we need to // be able to enumerate the keys. // - lock (s_systemClockChanged) + lock (_systemClockChanged) { var remove = default(HashSet>); - foreach (var handler in s_systemClockChanged) + foreach (var handler in _systemClockChanged) { if (!handler.TryGetTarget(out var scheduler)) { @@ -138,14 +138,14 @@ private static void CollectHandlers() { foreach (var handler in remove) { - s_systemClockChanged.Remove(handler); + _systemClockChanged.Remove(handler); } } - if (s_systemClockChanged.Count == 0) + if (_systemClockChanged.Count == 0) { - s_systemClockChangedHandlerCollector.Dispose(); - s_systemClockChangedHandlerCollector = null; + _systemClockChangedHandlerCollector.Dispose(); + _systemClockChangedHandlerCollector = null; } } } diff --git a/Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs b/Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs index 2f3fd9bf5a..9835b9281e 100644 --- a/Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs +++ b/Rx.NET/Source/src/System.Reactive/Joins/ActivePlan.cs @@ -8,21 +8,27 @@ namespace System.Reactive.Joins { internal abstract class ActivePlan { - private Dictionary joinObservers = new Dictionary(); + private Dictionary _joinObservers = new Dictionary(); + + protected readonly Action _onCompleted; internal abstract void Match(); + protected ActivePlan(Action onCompleted) + { + _onCompleted = onCompleted; + } protected void AddJoinObserver(IJoinObserver joinObserver) { - if (!joinObservers.ContainsKey(joinObserver)) + if (!_joinObservers.ContainsKey(joinObserver)) { - joinObservers.Add(joinObserver, joinObserver); + _joinObservers.Add(joinObserver, joinObserver); } } protected void Dequeue() { - foreach (var joinObserver in joinObservers.Values) + foreach (var joinObserver in _joinObservers.Values) { joinObserver.Dequeue(); } @@ -31,33 +37,30 @@ protected void Dequeue() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; + private readonly Action _onNext; + private readonly JoinObserver _first; - internal ActivePlan(JoinObserver first, Action onNext, Action onCompleted) + internal ActivePlan(JoinObserver first, Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; + _onNext = onNext; + _first = first; AddJoinObserver(first); } internal override void Match() { - if (first.Queue.Count > 0) + if (_first.Queue.Count > 0) { - var n1 = first.Queue.Peek(); + var n1 = _first.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value - ); + _onNext(n1.Value); } } } @@ -65,38 +68,36 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; - internal ActivePlan(JoinObserver first, JoinObserver second, Action onNext, Action onCompleted) + internal ActivePlan(JoinObserver first, JoinObserver second, Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; + _onNext = onNext; + _first = first; + _second = second; AddJoinObserver(first); AddJoinObserver(second); } internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value ); } @@ -106,19 +107,17 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; - internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, Action onNext, Action onCompleted) + internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; + _onNext = onNext; + _first = first; + _second = second; + _third = third; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -126,24 +125,24 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value ); @@ -154,21 +153,19 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - - internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, Action onNext, Action onCompleted) + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + + internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -177,27 +174,27 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value @@ -209,24 +206,22 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, - JoinObserver fourth, JoinObserver fifth, Action onNext, Action onCompleted) + JoinObserver fourth, JoinObserver fifth, Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -236,17 +231,17 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -254,12 +249,12 @@ internal override void Match() || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -272,27 +267,25 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -303,19 +296,19 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -324,12 +317,12 @@ internal override void Match() || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -343,29 +336,27 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -377,21 +368,21 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -401,12 +392,12 @@ internal override void Match() || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -421,32 +412,30 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -459,23 +448,23 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0) + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -487,12 +476,12 @@ internal override void Match() || n8.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -508,34 +497,32 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -549,26 +536,26 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -581,12 +568,12 @@ internal override void Match() || n9.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -603,36 +590,34 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -647,28 +632,28 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -682,12 +667,12 @@ internal override void Match() || n10.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -705,38 +690,36 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -752,30 +735,30 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -790,12 +773,12 @@ internal override void Match() || n11.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -814,41 +797,39 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; - private readonly JoinObserver twelfth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; + private readonly JoinObserver _twelfth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; - this.twelfth = twelfth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; + _twelfth = twelfth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -865,32 +846,32 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 - && twelfth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 + && _twelfth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); - var n12 = twelfth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); + var n12 = _twelfth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -906,12 +887,12 @@ internal override void Match() || n12.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -931,43 +912,41 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; - private readonly JoinObserver twelfth; - private readonly JoinObserver thirteenth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; + private readonly JoinObserver _twelfth; + private readonly JoinObserver _thirteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; - this.twelfth = twelfth; - this.thirteenth = thirteenth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; + _twelfth = twelfth; + _thirteenth = thirteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -985,34 +964,34 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 - && twelfth.Queue.Count > 0 - && thirteenth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 + && _twelfth.Queue.Count > 0 + && _thirteenth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); - var n12 = twelfth.Queue.Peek(); - var n13 = thirteenth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); + var n12 = _twelfth.Queue.Peek(); + var n13 = _thirteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -1029,12 +1008,12 @@ internal override void Match() || n13.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -1055,45 +1034,43 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; - private readonly JoinObserver twelfth; - private readonly JoinObserver thirteenth; - private readonly JoinObserver fourteenth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; + private readonly JoinObserver _twelfth; + private readonly JoinObserver _thirteenth; + private readonly JoinObserver _fourteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; - this.twelfth = twelfth; - this.thirteenth = thirteenth; - this.fourteenth = fourteenth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; + _twelfth = twelfth; + _thirteenth = thirteenth; + _fourteenth = fourteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -1112,36 +1089,36 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 - && twelfth.Queue.Count > 0 - && thirteenth.Queue.Count > 0 - && fourteenth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 + && _twelfth.Queue.Count > 0 + && _thirteenth.Queue.Count > 0 + && _fourteenth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); - var n12 = twelfth.Queue.Peek(); - var n13 = thirteenth.Queue.Peek(); - var n14 = fourteenth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); + var n12 = _twelfth.Queue.Peek(); + var n13 = _thirteenth.Queue.Peek(); + var n14 = _fourteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -1159,12 +1136,12 @@ internal override void Match() || n14.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -1186,48 +1163,46 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; - private readonly JoinObserver twelfth; - private readonly JoinObserver thirteenth; - private readonly JoinObserver fourteenth; - private readonly JoinObserver fifteenth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; + private readonly JoinObserver _twelfth; + private readonly JoinObserver _thirteenth; + private readonly JoinObserver _fourteenth; + private readonly JoinObserver _fifteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, JoinObserver fifteenth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; - this.twelfth = twelfth; - this.thirteenth = thirteenth; - this.fourteenth = fourteenth; - this.fifteenth = fifteenth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; + _twelfth = twelfth; + _thirteenth = thirteenth; + _fourteenth = fourteenth; + _fifteenth = fifteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -1247,38 +1222,38 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 - && twelfth.Queue.Count > 0 - && thirteenth.Queue.Count > 0 - && fourteenth.Queue.Count > 0 - && fifteenth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 + && _twelfth.Queue.Count > 0 + && _thirteenth.Queue.Count > 0 + && _fourteenth.Queue.Count > 0 + && _fifteenth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); - var n12 = twelfth.Queue.Peek(); - var n13 = thirteenth.Queue.Peek(); - var n14 = fourteenth.Queue.Peek(); - var n15 = fifteenth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); + var n12 = _twelfth.Queue.Peek(); + var n13 = _thirteenth.Queue.Peek(); + var n14 = _fourteenth.Queue.Peek(); + var n15 = _fifteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -1297,12 +1272,12 @@ internal override void Match() || n15.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, @@ -1325,50 +1300,48 @@ internal override void Match() internal class ActivePlan : ActivePlan { - private readonly Action onNext; - private readonly Action onCompleted; - private readonly JoinObserver first; - private readonly JoinObserver second; - private readonly JoinObserver third; - private readonly JoinObserver fourth; - private readonly JoinObserver fifth; - private readonly JoinObserver sixth; - private readonly JoinObserver seventh; - private readonly JoinObserver eighth; - private readonly JoinObserver ninth; - private readonly JoinObserver tenth; - private readonly JoinObserver eleventh; - private readonly JoinObserver twelfth; - private readonly JoinObserver thirteenth; - private readonly JoinObserver fourteenth; - private readonly JoinObserver fifteenth; - private readonly JoinObserver sixteenth; + private readonly Action _onNext; + private readonly JoinObserver _first; + private readonly JoinObserver _second; + private readonly JoinObserver _third; + private readonly JoinObserver _fourth; + private readonly JoinObserver _fifth; + private readonly JoinObserver _sixth; + private readonly JoinObserver _seventh; + private readonly JoinObserver _eighth; + private readonly JoinObserver _ninth; + private readonly JoinObserver _tenth; + private readonly JoinObserver _eleventh; + private readonly JoinObserver _twelfth; + private readonly JoinObserver _thirteenth; + private readonly JoinObserver _fourteenth; + private readonly JoinObserver _fifteenth; + private readonly JoinObserver _sixteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, JoinObserver fifteenth, JoinObserver sixteenth, - Action onNext, Action onCompleted) + Action onNext, Action onCompleted) : base(onCompleted) { - this.onNext = onNext; - this.onCompleted = onCompleted; - this.first = first; - this.second = second; - this.third = third; - this.fourth = fourth; - this.fifth = fifth; - this.sixth = sixth; - this.seventh = seventh; - this.eighth = eighth; - this.ninth = ninth; - this.tenth = tenth; - this.eleventh = eleventh; - this.twelfth = twelfth; - this.thirteenth = thirteenth; - this.fourteenth = fourteenth; - this.fifteenth = fifteenth; - this.sixteenth = sixteenth; + _onNext = onNext; + _first = first; + _second = second; + _third = third; + _fourth = fourth; + _fifth = fifth; + _sixth = sixth; + _seventh = seventh; + _eighth = eighth; + _ninth = ninth; + _tenth = tenth; + _eleventh = eleventh; + _twelfth = twelfth; + _thirteenth = thirteenth; + _fourteenth = fourteenth; + _fifteenth = fifteenth; + _sixteenth = sixteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); @@ -1389,40 +1362,40 @@ internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserve internal override void Match() { - if (first.Queue.Count > 0 - && second.Queue.Count > 0 - && third.Queue.Count > 0 - && fourth.Queue.Count > 0 - && fifth.Queue.Count > 0 - && sixth.Queue.Count > 0 - && seventh.Queue.Count > 0 - && eighth.Queue.Count > 0 - && ninth.Queue.Count > 0 - && tenth.Queue.Count > 0 - && eleventh.Queue.Count > 0 - && twelfth.Queue.Count > 0 - && thirteenth.Queue.Count > 0 - && fourteenth.Queue.Count > 0 - && fifteenth.Queue.Count > 0 - && sixteenth.Queue.Count > 0 + if (_first.Queue.Count > 0 + && _second.Queue.Count > 0 + && _third.Queue.Count > 0 + && _fourth.Queue.Count > 0 + && _fifth.Queue.Count > 0 + && _sixth.Queue.Count > 0 + && _seventh.Queue.Count > 0 + && _eighth.Queue.Count > 0 + && _ninth.Queue.Count > 0 + && _tenth.Queue.Count > 0 + && _eleventh.Queue.Count > 0 + && _twelfth.Queue.Count > 0 + && _thirteenth.Queue.Count > 0 + && _fourteenth.Queue.Count > 0 + && _fifteenth.Queue.Count > 0 + && _sixteenth.Queue.Count > 0 ) { - var n1 = first.Queue.Peek(); - var n2 = second.Queue.Peek(); - var n3 = third.Queue.Peek(); - var n4 = fourth.Queue.Peek(); - var n5 = fifth.Queue.Peek(); - var n6 = sixth.Queue.Peek(); - var n7 = seventh.Queue.Peek(); - var n8 = eighth.Queue.Peek(); - var n9 = ninth.Queue.Peek(); - var n10 = tenth.Queue.Peek(); - var n11 = eleventh.Queue.Peek(); - var n12 = twelfth.Queue.Peek(); - var n13 = thirteenth.Queue.Peek(); - var n14 = fourteenth.Queue.Peek(); - var n15 = fifteenth.Queue.Peek(); - var n16 = sixteenth.Queue.Peek(); + var n1 = _first.Queue.Peek(); + var n2 = _second.Queue.Peek(); + var n3 = _third.Queue.Peek(); + var n4 = _fourth.Queue.Peek(); + var n5 = _fifth.Queue.Peek(); + var n6 = _sixth.Queue.Peek(); + var n7 = _seventh.Queue.Peek(); + var n8 = _eighth.Queue.Peek(); + var n9 = _ninth.Queue.Peek(); + var n10 = _tenth.Queue.Peek(); + var n11 = _eleventh.Queue.Peek(); + var n12 = _twelfth.Queue.Peek(); + var n13 = _thirteenth.Queue.Peek(); + var n14 = _fourteenth.Queue.Peek(); + var n15 = _fifteenth.Queue.Peek(); + var n16 = _sixteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted @@ -1442,12 +1415,12 @@ internal override void Match() || n16.Kind == NotificationKind.OnCompleted ) { - onCompleted(); + _onCompleted(); } else { Dequeue(); - onNext(n1.Value, + _onNext(n1.Value, n2.Value, n3.Value, n4.Value, diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Aggregates.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Aggregates.cs index 96a025efb6..790cd4a0fb 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Aggregates.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Aggregates.cs @@ -213,13 +213,13 @@ public static IObservable Average(this IObservable source) } /// - /// Computes the average of an observable sequence of values. + /// Computes the average of an observable sequence of values. /// - /// A sequence of values to calculate the average of. + /// A sequence of values to calculate the average of. /// An observable sequence containing a single element with the average of the sequence of values. /// is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source) { @@ -238,7 +238,7 @@ public static IObservable Average(this IObservable source) /// An observable sequence containing a single element with the average of the sequence of values. /// is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source) { @@ -257,7 +257,7 @@ public static IObservable Average(this IObservable source) /// An observable sequence containing a single element with the average of the sequence of values. /// is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source) { @@ -306,13 +306,13 @@ public static IObservable Average(this IObservable source) } /// - /// Computes the average of an observable sequence of nullable values. + /// Computes the average of an observable sequence of nullable values. /// - /// A sequence of nullable values to calculate the average of. + /// A sequence of nullable values to calculate the average of. /// An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source) { @@ -332,7 +332,7 @@ public static IObservable Average(this IObservable source) /// is null. /// (Asynchronous) The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . public static IObservable Average(this IObservable source) { if (source == null) @@ -350,7 +350,7 @@ public static IObservable Average(this IObservable source) /// An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source) { @@ -363,7 +363,7 @@ public static IObservable Average(this IObservable source) } /// - /// Computes the average of an observable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an observable sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values to calculate the average of. @@ -371,7 +371,7 @@ public static IObservable Average(this IObservable source) /// An observable sequence containing a single element with the average of the sequence of values. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -447,7 +447,7 @@ public static IObservable Average(this IObservable sour /// An observable sequence containing a single element with the average of the sequence of values. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -473,7 +473,7 @@ public static IObservable Average(this IObservable sou /// An observable sequence containing a single element with the average of the sequence of values. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -491,7 +491,7 @@ public static IObservable Average(this IObservable sou } /// - /// Computes the average of an observable sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an observable sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values to calculate the average of. @@ -499,7 +499,7 @@ public static IObservable Average(this IObservable sou /// An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -575,7 +575,7 @@ public static IObservable Average(this IObservable sou /// An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -601,7 +601,7 @@ public static IObservable Average(this IObservable sou /// An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// or is null. /// (Asynchronous) The source sequence is empty. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Average(this IObservable source, Func selector) { @@ -677,7 +677,7 @@ public static IObservable Contains(this IObservable sour /// An observable sequence that contains elements to be counted. /// An observable sequence containing a single element with the number of elements in the input sequence. /// is null. - /// (Asynchronous) The number of elements in the source sequence is larger than . + /// (Asynchronous) The number of elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Count(this IObservable source) { @@ -982,7 +982,7 @@ public static IObservable LastOrDefaultAsync(this IObservable< /// An observable sequence that contains elements to be counted. /// An observable sequence containing a single element with the number of elements in the input sequence. /// is null. - /// (Asynchronous) The number of elements in the source sequence is larger than . + /// (Asynchronous) The number of elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable LongCount(this IObservable source) { @@ -1099,9 +1099,9 @@ public static IObservable Max(this IObservable source) } /// - /// Returns the maximum value in an observable sequence of values. + /// Returns the maximum value in an observable sequence of values. /// - /// A sequence of values to determine the maximum value of. + /// A sequence of values to determine the maximum value of. /// An observable sequence containing a single element with the maximum value in the source sequence. /// is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. @@ -1184,9 +1184,9 @@ public static IObservable Max(this IObservable source) } /// - /// Returns the maximum value in an observable sequence of nullable values. + /// Returns the maximum value in an observable sequence of nullable values. /// - /// A sequence of nullable values to determine the maximum value of. + /// A sequence of nullable values to determine the maximum value of. /// An observable sequence containing a single element with the maximum value in the source sequence. /// is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. @@ -1339,12 +1339,12 @@ public static IObservable Max(this IObservable source, } /// - /// Invokes a transform function on each element of a sequence and returns the maximum value. + /// Invokes a transform function on each element of a sequence and returns the maximum value. /// /// The type of the elements in the source sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. - /// An observable sequence containing a single element with the value of type that corresponds to the maximum value in the source sequence. + /// An observable sequence containing a single element with the value of type that corresponds to the maximum value in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Max(this IObservable source, Func selector) @@ -1459,7 +1459,7 @@ public static IObservable Max(this IObservable source, F } /// - /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. + /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// /// The type of the elements in the source sequence. /// A sequence of values to determine the maximum value of. @@ -1671,9 +1671,9 @@ public static IObservable Min(this IObservable source) } /// - /// Returns the minimum value in an observable sequence of values. + /// Returns the minimum value in an observable sequence of values. /// - /// A sequence of values to determine the minimum value of. + /// A sequence of values to determine the minimum value of. /// An observable sequence containing a single element with the minimum value in the source sequence. /// is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. @@ -1756,9 +1756,9 @@ public static IObservable Min(this IObservable source) } /// - /// Returns the minimum value in an observable sequence of nullable values. + /// Returns the minimum value in an observable sequence of nullable values. /// - /// A sequence of nullable values to determine the minimum value of. + /// A sequence of nullable values to determine the minimum value of. /// An observable sequence containing a single element with the minimum value in the source sequence. /// is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. @@ -1911,12 +1911,12 @@ public static IObservable Min(this IObservable source, } /// - /// Invokes a transform function on each element of a sequence and returns the minimum value. + /// Invokes a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. - /// An observable sequence containing a single element with the value of type that corresponds to the minimum value in the source sequence. + /// An observable sequence containing a single element with the value of type that corresponds to the minimum value in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Min(this IObservable source, Func selector) @@ -2031,7 +2031,7 @@ public static IObservable Min(this IObservable source, F } /// - /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. + /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// /// The type of the elements in the source sequence. /// A sequence of values to determine the minimum value of. @@ -2405,12 +2405,12 @@ public static IObservable Sum(this IObservable source) } /// - /// Computes the sum of a sequence of values. + /// Computes the sum of a sequence of values. /// - /// A sequence of values to calculate the sum of. + /// A sequence of values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2428,7 +2428,7 @@ public static IObservable Sum(this IObservable source) /// A sequence of values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2446,7 +2446,7 @@ public static IObservable Sum(this IObservable source) /// A sequence of values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2493,12 +2493,12 @@ public static IObservable Sum(this IObservable source) } /// - /// Computes the sum of a sequence of nullable values. + /// Computes the sum of a sequence of nullable values. /// - /// A sequence of nullable values to calculate the sum of. + /// A sequence of nullable values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2516,7 +2516,7 @@ public static IObservable Sum(this IObservable source) /// A sequence of nullable values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2534,7 +2534,7 @@ public static IObservable Sum(this IObservable source) /// A sequence of nullable values to calculate the sum of. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// is null. - /// (Asynchronous) The sum of the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source) { @@ -2595,14 +2595,14 @@ public static IObservable Sum(this IObservable source, } /// - /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { @@ -2627,7 +2627,7 @@ public static IObservable Sum(this IObservable source /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { @@ -2652,7 +2652,7 @@ public static IObservable Sum(this IObservable source, Fu /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { @@ -2718,14 +2718,14 @@ public static IObservable Sum(this IObservable source, F } /// - /// Computes the sum of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the sum of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { @@ -2750,7 +2750,7 @@ public static IObservable Sum(this IObservable source, F /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { @@ -2775,7 +2775,7 @@ public static IObservable Sum(this IObservable source, F /// A transform function to apply to each element. /// An observable sequence containing a single element with the sum of the values in the source sequence. /// or is null. - /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . + /// (Asynchronous) The sum of the projected values for the elements in the source sequence is larger than . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static IObservable Sum(this IObservable source, Func selector) { diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Awaiter.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Awaiter.cs index 8e9aa21596..1321118e5e 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Awaiter.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Awaiter.cs @@ -24,7 +24,7 @@ public static AsyncSubject GetAwaiter(this IObservable(source); + return s_impl.GetAwaiter(source); } /// @@ -42,7 +42,7 @@ public static AsyncSubject GetAwaiter(this IConnectableObserva throw new ArgumentNullException(nameof(source)); } - return s_impl.GetAwaiter(source); + return s_impl.GetAwaiter(source); } /// @@ -61,7 +61,7 @@ public static AsyncSubject RunAsync(this IObservable throw new ArgumentNullException(nameof(source)); } - return s_impl.RunAsync(source, cancellationToken); + return s_impl.RunAsync(source, cancellationToken); } /// @@ -80,7 +80,7 @@ public static AsyncSubject RunAsync(this IConnectableObservabl throw new ArgumentNullException(nameof(source)); } - return s_impl.RunAsync(source, cancellationToken); + return s_impl.RunAsync(source, cancellationToken); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Creation.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Creation.cs index 3d60628328..e07684570c 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Creation.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Creation.cs @@ -404,7 +404,7 @@ public static IObservable Never(TResult witness) /// The value of the first integer in the sequence. /// The number of sequential integers to generate. /// An observable sequence that contains a range of sequential integral numbers. - /// is less than zero. -or- + - 1 is larger than . + /// is less than zero. -or- + - 1 is larger than . public static IObservable Range(int start, int count) { var max = ((long)start) + count - 1; @@ -423,7 +423,7 @@ public static IObservable Range(int start, int count) /// The number of sequential integers to generate. /// Scheduler to run the generator loop on. /// An observable sequence that contains a range of sequential integral numbers. - /// is less than zero. -or- + - 1 is larger than . + /// is less than zero. -or- + - 1 is larger than . /// is null. public static IObservable Range(int start, int count, IScheduler scheduler) { diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Queryable.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Queryable.cs index b43c86dab5..569b8b8b87 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable.Queryable.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable.Queryable.cs @@ -8,7 +8,9 @@ namespace System.Reactive.Linq { public static partial class Qbservable { +#pragma warning disable IDE1006 // Naming Styles: 3rd party code is known to reflect for this specific field name private static IQbservableProvider s_provider; +#pragma warning restore IDE1006 // Naming Styles /// /// Gets the local query provider which will retarget Qbservable-based queries to the corresponding Observable-based query for in-memory execution upon subscription. @@ -45,4 +47,4 @@ public static IQbservable AsQbservable(this IObservable left, IObservable right) internal sealed class AmbCoordinator : IDisposable { - private readonly AmbObserver leftObserver; - private readonly AmbObserver rightObserver; - private int winner; + private readonly AmbObserver _leftObserver; + private readonly AmbObserver _rightObserver; + private int _winner; public AmbCoordinator(IObserver observer) { - leftObserver = new AmbObserver(observer, this, true); - rightObserver = new AmbObserver(observer, this, false); + _leftObserver = new AmbObserver(observer, this, true); + _rightObserver = new AmbObserver(observer, this, false); } public void Run(IObservable left, IObservable right) { - leftObserver.OnSubscribe(left.Subscribe(leftObserver)); - rightObserver.OnSubscribe(right.Subscribe(rightObserver)); + _leftObserver.Run(left); + _rightObserver.Run(right); } public void Dispose() { - leftObserver.Dispose(); - rightObserver.Dispose(); + _leftObserver.Dispose(); + _rightObserver.Dispose(); } /// @@ -55,89 +54,80 @@ public bool TryWin(bool isLeft) { var index = isLeft ? 1 : 2; - if (Volatile.Read(ref winner) == index) + if (Volatile.Read(ref _winner) == index) { return true; } - if (Interlocked.CompareExchange(ref winner, index, 0) == 0) + if (Interlocked.CompareExchange(ref _winner, index, 0) == 0) { - (isLeft ? rightObserver : leftObserver).Dispose(); + (isLeft ? _rightObserver : _leftObserver).Dispose(); return true; } return false; } - private sealed class AmbObserver : IObserver, IDisposable + private sealed class AmbObserver : IdentitySink { - private readonly IObserver downstream; - private readonly AmbCoordinator parent; - private readonly bool isLeft; - private IDisposable upstream; + private readonly AmbCoordinator _parent; + private readonly bool _isLeft; /// /// If true, this observer won the race and now can emit /// on a fast path. /// - private bool iwon; + private bool _iwon; - public AmbObserver(IObserver downstream, AmbCoordinator parent, bool isLeft) + public AmbObserver(IObserver downstream, AmbCoordinator parent, bool isLeft) : base(downstream) { - this.downstream = downstream; - this.parent = parent; - this.isLeft = isLeft; + _parent = parent; + _isLeft = isLeft; } - internal void OnSubscribe(IDisposable d) + public override void OnCompleted() { - Disposable.SetSingle(ref upstream, d); - } - - public void Dispose() - { - Disposable.TryDispose(ref upstream); - } - - public void OnCompleted() - { - if (iwon) + if (_iwon) + { + ForwardOnCompleted(); + } + else if (_parent.TryWin(_isLeft)) { - downstream.OnCompleted(); + _iwon = true; + ForwardOnCompleted(); } else - if (parent.TryWin(isLeft)) { - iwon = true; - downstream.OnCompleted(); + Dispose(); } - Dispose(); } - public void OnError(Exception error) + public override void OnError(Exception error) { - if (iwon) + if (_iwon) + { + ForwardOnError(error); + } + else if (_parent.TryWin(_isLeft)) { - downstream.OnError(error); + _iwon = true; + ForwardOnError(error); } else - if (parent.TryWin(isLeft)) { - iwon = true; - downstream.OnError(error); + Dispose(); } - Dispose(); } - public void OnNext(TSource value) + public override void OnNext(TSource value) { - if (iwon) + if (_iwon) { - downstream.OnNext(value); + ForwardOnNext(value); } else - if (parent.TryWin(isLeft)) + if (_parent.TryWin(_isLeft)) { - iwon = true; - downstream.OnNext(value); + _iwon = true; + ForwardOnNext(value); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/AmbMany.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/AmbMany.cs index 8b4c1cbd8c..e559d5188e 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/AmbMany.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/AmbMany.cs @@ -11,31 +11,31 @@ namespace System.Reactive.Linq.ObservableImpl { internal sealed class AmbManyArray : BasicProducer { - private readonly IObservable[] sources; + private readonly IObservable[] _sources; public AmbManyArray(IObservable[] sources) { - this.sources = sources; + _sources = sources; } protected override IDisposable Run(IObserver observer) { - return AmbCoordinator.Create(observer, sources); + return AmbCoordinator.Create(observer, _sources); } } internal sealed class AmbManyEnumerable : BasicProducer { - private readonly IEnumerable> sources; + private readonly IEnumerable> _sources; public AmbManyEnumerable(IEnumerable> sources) { - this.sources = sources; + _sources = sources; } protected override IDisposable Run(IObserver observer) { - var sourcesEnumerable = this.sources; + var sourcesEnumerable = _sources; var sources = default(IObservable[]); try @@ -54,20 +54,20 @@ protected override IDisposable Run(IObserver observer) internal sealed class AmbCoordinator : IDisposable { - private readonly IObserver downstream; - private readonly InnerObserver[] observers; - private int winner; + private readonly IObserver _downstream; + private readonly InnerObserver[] _observers; + private int _winner; internal AmbCoordinator(IObserver downstream, int n) { - this.downstream = downstream; + _downstream = downstream; var o = new InnerObserver[n]; for (var i = 0; i < n; i++) { o[i] = new InnerObserver(this, i); } - observers = o; - Volatile.Write(ref winner, -1); + _observers = o; + Volatile.Write(ref _winner, -1); } internal static IDisposable Create(IObserver observer, IObservable[] sources) @@ -93,34 +93,34 @@ internal static IDisposable Create(IObserver observer, IObservable[] sourc internal void Subscribe(IObservable[] sources) { - for (var i = 0; i < observers.Length; i++) + for (var i = 0; i < _observers.Length; i++) { - var inner = Volatile.Read(ref observers[i]); + var inner = Volatile.Read(ref _observers[i]); if (inner == null) { break; } - inner.OnSubscribe(sources[i].Subscribe(inner)); + inner.Run(sources[i]); } } public void Dispose() { - for (var i = 0; i < observers.Length; i++) + for (var i = 0; i < _observers.Length; i++) { - Interlocked.Exchange(ref observers[i], null)?.Dispose(); + Interlocked.Exchange(ref _observers[i], null)?.Dispose(); } } private bool TryWin(int index) { - if (Volatile.Read(ref winner) == -1 && Interlocked.CompareExchange(ref winner, index, -1) == -1) + if (Volatile.Read(ref _winner) == -1 && Interlocked.CompareExchange(ref _winner, index, -1) == -1) { - for (var i = 0; i < observers.Length; i++) + for (var i = 0; i < _observers.Length; i++) { if (index != i) { - Interlocked.Exchange(ref observers[i], null)?.Dispose(); + Interlocked.Exchange(ref _observers[i], null)?.Dispose(); } } return true; @@ -128,79 +128,68 @@ private bool TryWin(int index) return false; } - internal sealed class InnerObserver : IObserver, IDisposable + internal sealed class InnerObserver : IdentitySink { - private readonly IObserver downstream; - private readonly AmbCoordinator parent; - private readonly int index; - private IDisposable upstream; - private bool won; - - public InnerObserver(AmbCoordinator parent, int index) - { - downstream = parent.downstream; - this.parent = parent; - this.index = index; - } + private readonly AmbCoordinator _parent; + private readonly int _index; + private bool _won; - public void Dispose() + public InnerObserver(AmbCoordinator parent, int index) : base(parent._downstream) { - Disposable.TryDispose(ref upstream); + _parent = parent; + _index = index; } - public void OnCompleted() + public override void OnCompleted() { - if (won) + if (_won) { - downstream.OnCompleted(); + ForwardOnCompleted(); + } + else if (_parent.TryWin(_index)) + { + _won = true; + ForwardOnCompleted(); } else - if (parent.TryWin(index)) { - won = true; - downstream.OnCompleted(); + Dispose(); } - Dispose(); } - public void OnError(Exception error) + public override void OnError(Exception error) { - if (won) + if (_won) { - downstream.OnError(error); + ForwardOnError(error); + } + else if (_parent.TryWin(_index)) + { + _won = true; + ForwardOnError(error); } else - if (parent.TryWin(index)) { - won = true; - downstream.OnError(error); + Dispose(); } - Dispose(); } - public void OnNext(T value) + public override void OnNext(T value) { - if (won) + if (_won) { - downstream.OnNext(value); + ForwardOnNext(value); } - else - if (parent.TryWin(index)) + else if (_parent.TryWin(_index)) { - won = true; - downstream.OnNext(value); + _won = true; + ForwardOnNext(value); } else { Dispose(); } } - - internal void OnSubscribe(IDisposable d) - { - Disposable.SetSingle(ref upstream, d); - } } - } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/AutoConnect.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/AutoConnect.cs index c02ed1c950..d35e5b0bd6 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/AutoConnect.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/AutoConnect.cs @@ -14,28 +14,28 @@ namespace System.Reactive.Linq.ObservableImpl /// The upstream value type. internal sealed class AutoConnect : IObservable { - private readonly IConnectableObservable source; - private readonly int minObservers; - private readonly Action onConnect; - private int count; + private readonly IConnectableObservable _source; + private readonly int _minObservers; + private readonly Action _onConnect; + private int _count; internal AutoConnect(IConnectableObservable source, int minObservers, Action onConnect) { - this.source = source; - this.minObservers = minObservers; - this.onConnect = onConnect; + _source = source; + _minObservers = minObservers; + _onConnect = onConnect; } public IDisposable Subscribe(IObserver observer) { - var d = source.Subscribe(observer); + var d = _source.Subscribe(observer); - if (Volatile.Read(ref count) < minObservers) + if (Volatile.Read(ref _count) < _minObservers) { - if (Interlocked.Increment(ref count) == minObservers) + if (Interlocked.Increment(ref _count) == _minObservers) { - var c = source.Connect(); - onConnect?.Invoke(c); + var c = _source.Connect(); + _onConnect?.Invoke(c); } } return d; diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Buffer.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Buffer.cs index 3f565c52b7..f53c0cb0ad 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Buffer.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Buffer.cs @@ -292,7 +292,7 @@ public void Run(TimeSliding parent) CreateWindow(); CreateTimer(); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) @@ -449,7 +449,7 @@ public void Run(TimeHopping parent) _list = new List(); Disposable.SetSingle(ref _periodicDisposable, parent._scheduler.SchedulePeriodic(this, parent._timeSpan, @this => @this.Tick())); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) @@ -805,7 +805,7 @@ public void Run(Boundaries parent) { _buffer = new List(); - base.Run(parent._source); + Run(parent._source); Disposable.SetSingle(ref _boundariesDisposable, parent._bufferBoundaries.SubscribeSafe(new BufferClosingObserver(this))); } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Case.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Case.cs index 666381b9ba..49e01796af 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Case.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Case.cs @@ -54,7 +54,7 @@ public void Run(Case parent) return; } - base.Run(result); + Run(result); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ConcatMany.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ConcatMany.cs index d88bfeccd5..d055bbc130 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ConcatMany.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ConcatMany.cs @@ -10,11 +10,11 @@ namespace System.Reactive.Linq.ObservableImpl { internal sealed class ConcatMany : IObservable { - private readonly IObservable> sources; + private readonly IObservable> _sources; internal ConcatMany(IObservable> sources) { - this.sources = sources; + _sources = sources; } public IDisposable Subscribe(IObserver observer) @@ -24,84 +24,84 @@ public IDisposable Subscribe(IObserver observer) throw new ArgumentNullException(nameof(observer)); } var parent = new ConcatManyOuterObserver(observer); - var d = sources.SubscribeSafe(parent); + var d = _sources.SubscribeSafe(parent); parent.OnSubscribe(d); return parent; } internal sealed class ConcatManyOuterObserver : IObserver>, IDisposable { - private readonly IObserver downstream; - private readonly ConcurrentQueue> queue; - private readonly InnerObserver innerObserver; - private IDisposable upstream; - private int trampoline; - private Exception error; - private bool done; - private int active; + private readonly IObserver _downstream; + private readonly ConcurrentQueue> _queue; + private readonly InnerObserver _innerObserver; + private IDisposable _upstream; + private int _trampoline; + private Exception _error; + private bool _done; + private int _active; internal ConcatManyOuterObserver(IObserver downstream) { - this.downstream = downstream; - queue = new ConcurrentQueue>(); - innerObserver = new InnerObserver(this); + _downstream = downstream; + _queue = new ConcurrentQueue>(); + _innerObserver = new InnerObserver(this); } internal void OnSubscribe(IDisposable d) { - Disposable.SetSingle(ref upstream, d); + Disposable.SetSingle(ref _upstream, d); } public void Dispose() { - innerObserver.Dispose(); + _innerObserver.Dispose(); DisposeMain(); } private void DisposeMain() { - Disposable.TryDispose(ref upstream); + Disposable.TryDispose(ref _upstream); } private bool IsDisposed() { - return Disposable.GetIsDisposed(ref upstream); + return Disposable.GetIsDisposed(ref _upstream); } public void OnCompleted() { - Volatile.Write(ref done, true); + Volatile.Write(ref _done, true); Drain(); } public void OnError(Exception error) { - if (Interlocked.CompareExchange(ref this.error, error, null) == null) + if (Interlocked.CompareExchange(ref _error, error, null) == null) { - Volatile.Write(ref done, true); + Volatile.Write(ref _done, true); Drain(); } } public void OnNext(IObservable value) { - queue.Enqueue(value); + _queue.Enqueue(value); Drain(); } private void InnerNext(T item) { - downstream.OnNext(item); + _downstream.OnNext(item); } private void InnerError(Exception error) { - if (innerObserver.Finish()) + if (_innerObserver.Finish()) { - if (Interlocked.CompareExchange(ref this.error, error, null) == null) + if (Interlocked.CompareExchange(ref _error, error, null) == null) { - Volatile.Write(ref done, true); - Volatile.Write(ref active, 0); + Volatile.Write(ref _done, true); + Volatile.Write(ref _active, 0); Drain(); } } @@ -109,16 +109,16 @@ private void InnerError(Exception error) private void InnerComplete() { - if (innerObserver.Finish()) + if (_innerObserver.Finish()) { - Volatile.Write(ref active, 0); + Volatile.Write(ref _active, 0); Drain(); } } private void Drain() { - if (Interlocked.Increment(ref trampoline) != 1) + if (Interlocked.Increment(ref _trampoline) != 1) { return; } @@ -127,72 +127,72 @@ private void Drain() { if (IsDisposed()) { - while (queue.TryDequeue(out var _)) + while (_queue.TryDequeue(out var _)) { ; } } else { - if (Volatile.Read(ref active) == 0) + if (Volatile.Read(ref _active) == 0) { - var isDone = Volatile.Read(ref done); + var isDone = Volatile.Read(ref _done); if (isDone) { - var ex = Volatile.Read(ref error); + var ex = Volatile.Read(ref _error); if (ex != null) { - downstream.OnError(ex); + _downstream.OnError(ex); DisposeMain(); continue; } } - if (queue.TryDequeue(out var source)) + if (_queue.TryDequeue(out var source)) { var sad = new SingleAssignmentDisposable(); - if (innerObserver.SetDisposable(sad)) + if (_innerObserver.SetDisposable(sad)) { - Interlocked.Exchange(ref active, 1); - sad.Disposable = source.SubscribeSafe(innerObserver); + Interlocked.Exchange(ref _active, 1); + sad.Disposable = source.SubscribeSafe(_innerObserver); } } else { if (isDone) { - downstream.OnCompleted(); + _downstream.OnCompleted(); DisposeMain(); } } } } - } while (Interlocked.Decrement(ref trampoline) != 0); + } while (Interlocked.Decrement(ref _trampoline) != 0); } internal sealed class InnerObserver : IObserver, IDisposable { - private readonly ConcatManyOuterObserver parent; + private readonly ConcatManyOuterObserver _parent; - internal IDisposable upstream; + internal IDisposable Upstream; internal InnerObserver(ConcatManyOuterObserver parent) { - this.parent = parent; + _parent = parent; } internal bool SetDisposable(SingleAssignmentDisposable sad) { - return Disposable.TrySetSingle(ref upstream, sad) == TrySetSingleResult.Success; + return Disposable.TrySetSingle(ref Upstream, sad) == TrySetSingleResult.Success; } internal bool Finish() { - var sad = Volatile.Read(ref upstream); + var sad = Volatile.Read(ref Upstream); if (sad != BooleanDisposable.True) { - if (Interlocked.CompareExchange(ref upstream, null, sad) == sad) + if (Interlocked.CompareExchange(ref Upstream, null, sad) == sad) { sad.Dispose(); return true; @@ -203,22 +203,22 @@ internal bool Finish() public void Dispose() { - Disposable.TryDispose(ref upstream); + Disposable.TryDispose(ref Upstream); } public void OnCompleted() { - parent.InnerComplete(); + _parent.InnerComplete(); } public void OnError(Exception error) { - parent.InnerError(error); + _parent.InnerError(error); } public void OnNext(T value) { - parent.InnerNext(value); + _parent.InnerNext(value); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Defer.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Defer.cs index 5e9e105f58..ad8c68fe22 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Defer.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Defer.cs @@ -44,7 +44,7 @@ public void Run() return; } - base.Run(result); + Run(result); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/FirstLastBlocking.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/FirstLastBlocking.cs index b1b61b077b..a1ced80e4d 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/FirstLastBlocking.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/FirstLastBlocking.cs @@ -14,7 +14,7 @@ internal abstract class BaseBlocking : CountdownEvent, IObserver internal T _value; internal bool _hasValue; internal Exception _error; - private int once; + private int _once; internal BaseBlocking() : base(1) { } @@ -25,7 +25,7 @@ internal void SetUpstream(IDisposable d) protected void Unblock() { - if (Interlocked.CompareExchange(ref once, 1, 0) == 0) + if (Interlocked.CompareExchange(ref _once, 1, 0) == 0) { Signal(); } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Multicast.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Multicast.cs index 30b6a3fdda..09592b573e 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Multicast.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Multicast.cs @@ -49,7 +49,7 @@ public void Run(Multicast parent) return; } - base.Run(observable); + Run(observable); Disposable.SetSingle(ref _connection, connectable.Connect()); } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RefCount.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RefCount.cs index 466e9f258b..261b8d8d37 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RefCount.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RefCount.cs @@ -40,7 +40,7 @@ public _(IObserver observer, Eager parent) public void Run() { - base.Run(_parent._source); + Run(_parent._source); lock (_parent._gate) { diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Repeat.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Repeat.cs index 3aac83a662..4329795b5a 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Repeat.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Repeat.cs @@ -28,7 +28,7 @@ internal sealed class _ : IdentitySink { private readonly TResult _value; - IDisposable _task; + private IDisposable _task; public _(TResult value, IObserver observer) : base(observer) @@ -127,9 +127,9 @@ internal sealed class _ : IdentitySink { private readonly TResult _value; - int _remaining; + private int _remaining; - IDisposable _task; + private IDisposable _task; public _(TResult value, int repeatCount, IObserver observer) : base(observer) @@ -197,7 +197,7 @@ internal sealed class _ : IdentitySink { private readonly TResult _value; - int _remaining; + private readonly int _remaining; public _(TResult value, int remaining, IObserver observer) : base(observer) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RepeatWhen.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RepeatWhen.cs index cb650b4c1d..18dff819d1 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RepeatWhen.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RepeatWhen.cs @@ -10,13 +10,13 @@ namespace System.Reactive.Linq.ObservableImpl { internal sealed class RepeatWhen : IObservable { - private readonly IObservable source; - private readonly Func, IObservable> handler; + private readonly IObservable _source; + private readonly Func, IObservable> _handler; internal RepeatWhen(IObservable source, Func, IObservable> handler) { - this.source = source; - this.handler = handler; + _source = source; + _handler = handler; } public IDisposable Subscribe(IObserver observer) @@ -31,7 +31,7 @@ public IDisposable Subscribe(IObserver observer) try { - redo = handler(completeSignals); + redo = _handler(completeSignals); if (redo == null) { throw new NullReferenceException("The handler returned a null IObservable"); @@ -43,10 +43,10 @@ public IDisposable Subscribe(IObserver observer) return Disposable.Empty; } - var parent = new MainObserver(observer, source, new RedoSerializedObserver(completeSignals)); + var parent = new MainObserver(observer, _source, new RedoSerializedObserver(completeSignals)); - var d = redo.SubscribeSafe(parent.handlerObserver); - Disposable.SetSingle(ref parent.handlerUpstream, d); + var d = redo.SubscribeSafe(parent.HandlerConsumer); + Disposable.SetSingle(ref parent.HandlerUpstream, d); parent.HandlerNext(); @@ -55,103 +55,103 @@ public IDisposable Subscribe(IObserver observer) private sealed class MainObserver : Sink, IObserver { - private readonly IObserver errorSignal; + private readonly IObserver _errorSignal; - internal readonly HandlerObserver handlerObserver; - private readonly IObservable source; - private IDisposable upstream; + internal readonly HandlerObserver HandlerConsumer; + private readonly IObservable _source; + private IDisposable _upstream; - internal IDisposable handlerUpstream; - private int trampoline; - private int halfSerializer; - private Exception error; + internal IDisposable HandlerUpstream; + private int _trampoline; + private int _halfSerializer; + private Exception _error; internal MainObserver(IObserver downstream, IObservable source, IObserver errorSignal) : base(downstream) { - this.source = source; - this.errorSignal = errorSignal; - handlerObserver = new HandlerObserver(this); + _source = source; + _errorSignal = errorSignal; + HandlerConsumer = new HandlerObserver(this); } protected override void Dispose(bool disposing) { if (disposing) { - Disposable.TryDispose(ref upstream); - Disposable.TryDispose(ref handlerUpstream); + Disposable.TryDispose(ref _upstream); + Disposable.TryDispose(ref HandlerUpstream); } base.Dispose(disposing); } public void OnCompleted() { - if (Disposable.TrySetSerial(ref upstream, null)) + if (Disposable.TrySetSerial(ref _upstream, null)) { - errorSignal.OnNext(null); + _errorSignal.OnNext(null); } } public void OnError(Exception error) { - HalfSerializer.ForwardOnError(this, error, ref halfSerializer, ref this.error); + HalfSerializer.ForwardOnError(this, error, ref _halfSerializer, ref _error); } public void OnNext(T value) { - HalfSerializer.ForwardOnNext(this, value, ref halfSerializer, ref error); + HalfSerializer.ForwardOnNext(this, value, ref _halfSerializer, ref _error); } internal void HandlerError(Exception error) { - HalfSerializer.ForwardOnError(this, error, ref halfSerializer, ref this.error); + HalfSerializer.ForwardOnError(this, error, ref _halfSerializer, ref _error); } internal void HandlerComplete() { - HalfSerializer.ForwardOnCompleted(this, ref halfSerializer, ref error); + HalfSerializer.ForwardOnCompleted(this, ref _halfSerializer, ref _error); } internal void HandlerNext() { - if (Interlocked.Increment(ref trampoline) == 1) + if (Interlocked.Increment(ref _trampoline) == 1) { do { var sad = new SingleAssignmentDisposable(); - if (Interlocked.CompareExchange(ref upstream, sad, null) != null) + if (Interlocked.CompareExchange(ref _upstream, sad, null) != null) { return; } - sad.Disposable = source.SubscribeSafe(this); + sad.Disposable = _source.SubscribeSafe(this); } - while (Interlocked.Decrement(ref trampoline) != 0); + while (Interlocked.Decrement(ref _trampoline) != 0); } } internal sealed class HandlerObserver : IObserver { - private readonly MainObserver main; + private readonly MainObserver _main; internal HandlerObserver(MainObserver main) { - this.main = main; + _main = main; } public void OnCompleted() { - main.HandlerComplete(); + _main.HandlerComplete(); } public void OnError(Exception error) { - main.HandlerError(error); + _main.HandlerError(error); } public void OnNext(U value) { - main.HandlerNext(); + _main.HandlerNext(); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs index 5e84c34fce..7984644b93 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/RetryWhen.cs @@ -11,13 +11,13 @@ namespace System.Reactive.Linq.ObservableImpl { internal sealed class RetryWhen : IObservable { - private readonly IObservable source; - private readonly Func, IObservable> handler; + private readonly IObservable _source; + private readonly Func, IObservable> _handler; internal RetryWhen(IObservable source, Func, IObservable> handler) { - this.source = source; - this.handler = handler; + _source = source; + _handler = handler; } public IDisposable Subscribe(IObserver observer) @@ -32,7 +32,7 @@ public IDisposable Subscribe(IObserver observer) try { - redo = handler(errorSignals); + redo = _handler(errorSignals); if (redo == null) { throw new NullReferenceException("The handler returned a null IObservable"); @@ -44,10 +44,10 @@ public IDisposable Subscribe(IObserver observer) return Disposable.Empty; } - var parent = new MainObserver(observer, source, new RedoSerializedObserver(errorSignals)); + var parent = new MainObserver(observer, _source, new RedoSerializedObserver(errorSignals)); - var d = redo.SubscribeSafe(parent.handlerObserver); - Disposable.SetSingle(ref parent.handlerUpstream, d); + var d = redo.SubscribeSafe(parent.HandlerConsumer); + Disposable.SetSingle(ref parent.HandlerUpstream, d); parent.HandlerNext(); @@ -56,101 +56,101 @@ public IDisposable Subscribe(IObserver observer) private sealed class MainObserver : Sink, IObserver { - private readonly IObserver errorSignal; + private readonly IObserver _errorSignal; - internal readonly HandlerObserver handlerObserver; - private readonly IObservable source; - private IDisposable upstream; - internal IDisposable handlerUpstream; - private int trampoline; - private int halfSerializer; - private Exception error; + internal readonly HandlerObserver HandlerConsumer; + private readonly IObservable _source; + private IDisposable _upstream; + internal IDisposable HandlerUpstream; + private int _trampoline; + private int _halfSerializer; + private Exception _error; internal MainObserver(IObserver downstream, IObservable source, IObserver errorSignal) : base(downstream) { - this.source = source; - this.errorSignal = errorSignal; - handlerObserver = new HandlerObserver(this); + _source = source; + _errorSignal = errorSignal; + HandlerConsumer = new HandlerObserver(this); } protected override void Dispose(bool disposing) { if (disposing) { - Disposable.TryDispose(ref upstream); - Disposable.TryDispose(ref handlerUpstream); + Disposable.TryDispose(ref _upstream); + Disposable.TryDispose(ref HandlerUpstream); } base.Dispose(disposing); } public void OnCompleted() { - HalfSerializer.ForwardOnCompleted(this, ref halfSerializer, ref error); + HalfSerializer.ForwardOnCompleted(this, ref _halfSerializer, ref _error); } public void OnError(Exception error) { - if (Disposable.TrySetSerial(ref upstream, null)) + if (Disposable.TrySetSerial(ref _upstream, null)) { - errorSignal.OnNext(error); + _errorSignal.OnNext(error); } } public void OnNext(T value) { - HalfSerializer.ForwardOnNext(this, value, ref halfSerializer, ref error); + HalfSerializer.ForwardOnNext(this, value, ref _halfSerializer, ref _error); } internal void HandlerError(Exception error) { - HalfSerializer.ForwardOnError(this, error, ref halfSerializer, ref this.error); + HalfSerializer.ForwardOnError(this, error, ref _halfSerializer, ref _error); } internal void HandlerComplete() { - HalfSerializer.ForwardOnCompleted(this, ref halfSerializer, ref error); + HalfSerializer.ForwardOnCompleted(this, ref _halfSerializer, ref _error); } internal void HandlerNext() { - if (Interlocked.Increment(ref trampoline) == 1) + if (Interlocked.Increment(ref _trampoline) == 1) { do { var sad = new SingleAssignmentDisposable(); - if (Disposable.TrySetSingle(ref upstream, sad) != TrySetSingleResult.Success) + if (Disposable.TrySetSingle(ref _upstream, sad) != TrySetSingleResult.Success) { return; } - sad.Disposable = source.SubscribeSafe(this); + sad.Disposable = _source.SubscribeSafe(this); } - while (Interlocked.Decrement(ref trampoline) != 0); + while (Interlocked.Decrement(ref _trampoline) != 0); } } internal sealed class HandlerObserver : IObserver { - private readonly MainObserver main; + private readonly MainObserver _main; internal HandlerObserver(MainObserver main) { - this.main = main; + _main = main; } public void OnCompleted() { - main.HandlerComplete(); + _main.HandlerComplete(); } public void OnError(Exception error) { - main.HandlerError(error); + _main.HandlerError(error); } public void OnNext(U value) { - main.HandlerNext(); + _main.HandlerNext(); } } } @@ -158,22 +158,22 @@ public void OnNext(U value) internal sealed class RedoSerializedObserver : IObserver { - private readonly IObserver downstream; - private int wip; - private Exception terminalException; - private static readonly Exception DONE = new Exception(); - private static readonly Exception SIGNALED = new Exception(); - private readonly ConcurrentQueue queue; + private readonly IObserver _downstream; + private int _wip; + private Exception _terminalException; + private static readonly Exception DoneIndicator = new Exception(); + private static readonly Exception SignaledIndicator = new Exception(); + private readonly ConcurrentQueue _queue; internal RedoSerializedObserver(IObserver downstream) { - this.downstream = downstream; - queue = new ConcurrentQueue(); + _downstream = downstream; + _queue = new ConcurrentQueue(); } public void OnCompleted() { - if (Interlocked.CompareExchange(ref terminalException, DONE, null) == null) + if (Interlocked.CompareExchange(ref _terminalException, DoneIndicator, null) == null) { Drain(); } @@ -181,7 +181,7 @@ public void OnCompleted() public void OnError(Exception error) { - if (Interlocked.CompareExchange(ref terminalException, error, null) == null) + if (Interlocked.CompareExchange(ref _terminalException, error, null) == null) { Drain(); } @@ -189,13 +189,13 @@ public void OnError(Exception error) public void OnNext(X value) { - queue.Enqueue(value); + _queue.Enqueue(value); Drain(); } private void Clear() { - while (queue.TryDequeue(out var _)) + while (_queue.TryDequeue(out var _)) { ; } @@ -203,7 +203,7 @@ private void Clear() private void Drain() { - if (Interlocked.Increment(ref wip) != 1) + if (Interlocked.Increment(ref _wip) != 1) { return; } @@ -212,33 +212,33 @@ private void Drain() for (; ; ) { - var ex = Volatile.Read(ref terminalException); + var ex = Volatile.Read(ref _terminalException); if (ex != null) { - if (ex != SIGNALED) + if (ex != SignaledIndicator) { - Interlocked.Exchange(ref terminalException, SIGNALED); - if (ex != DONE) + Interlocked.Exchange(ref _terminalException, SignaledIndicator); + if (ex != DoneIndicator) { - downstream.OnError(ex); + _downstream.OnError(ex); } else { - downstream.OnCompleted(); + _downstream.OnCompleted(); } } Clear(); } else { - while (queue.TryDequeue(out var item)) + while (_queue.TryDequeue(out var item)) { - downstream.OnNext(item); + _downstream.OnNext(item); } } - missed = Interlocked.Add(ref wip, -missed); + missed = Interlocked.Add(ref _wip, -missed); if (missed == 0) { break; diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs index 1db2d533a4..1f8a271411 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/SkipUntil.cs @@ -37,7 +37,7 @@ public _(IObserver observer) public void Run(SkipUntil parent) { Disposable.TrySetSingle(ref _otherDisposable, parent._other.Subscribe(new OtherObserver(this))); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) @@ -171,7 +171,7 @@ public _(IObserver observer) public void Run(SkipUntil parent) { Disposable.SetSingle(ref _task, parent._scheduler.Schedule(this, parent._startTime, (_, state) => state.Tick())); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs index df8ca2813d..04ea6ae5b8 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Take.cs @@ -123,7 +123,7 @@ public void Run(Time parent) _gate = new object(); Disposable.SetSingle(ref _task, parent._scheduler.Schedule(this, parent._duration, (_, state) => state.Tick())); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs index 88274559aa..4664646ba7 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLast.cs @@ -114,7 +114,7 @@ private void Loop(ICancelable cancel) n--; } - base.Dispose(); + Dispose(); } } } @@ -142,14 +142,14 @@ internal sealed class _ : IdentitySink { private readonly TimeSpan _duration; private readonly IScheduler _loopScheduler; - private Queue> _queue; + private Queue> _queue; public _(Time parent, IObserver observer) : base(observer) { _duration = parent._duration; _loopScheduler = parent._loopScheduler; - _queue = new Queue>(); + _queue = new Queue>(); } private IDisposable _loopDisposable; @@ -158,7 +158,7 @@ public _(Time parent, IObserver observer) public void Run(IObservable source, IScheduler scheduler) { _watch = scheduler.StartStopwatch(); - base.Run(source); + Run(source); } protected override void Dispose(bool disposing) @@ -173,7 +173,7 @@ protected override void Dispose(bool disposing) public override void OnNext(TSource value) { var now = _watch.Elapsed; - _queue.Enqueue(new System.Reactive.TimeInterval(value, now)); + _queue.Enqueue(new Reactive.TimeInterval(value, now)); Trim(now); } @@ -231,7 +231,7 @@ private void Loop(ICancelable cancel) n--; } - base.Dispose(); + Dispose(); } private void Trim(TimeSpan now) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLastBuffer.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLastBuffer.cs index 0b2dc691df..e776733b09 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLastBuffer.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeLastBuffer.cs @@ -94,7 +94,7 @@ public void Run(IObservable source, IScheduler scheduler) { _watch = scheduler.StartStopwatch(); - base.Run(source); + Run(source); } public override void OnNext(TSource value) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs index 8044e971d2..6cc2f90a4e 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TakeUntil.cs @@ -36,7 +36,7 @@ public _(IObserver observer) public void Run(TakeUntil parent) { Disposable.SetSingle(ref _otherDisposable, parent._other.Subscribe(new OtherObserver(this))); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) @@ -148,7 +148,7 @@ public _(IObserver observer) public void Run(TakeUntil parent) { Disposable.SetSingle(ref _timerDisposable, parent._scheduler.Schedule(this, parent._endTime, (_, state) => state.Tick())); - base.Run(parent._source); + Run(parent._source); } protected override void Dispose(bool disposing) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TimeInterval.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TimeInterval.cs index e0df0e316d..00ecc436e6 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/TimeInterval.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/TimeInterval.cs @@ -6,7 +6,7 @@ namespace System.Reactive.Linq.ObservableImpl { - internal sealed class TimeInterval : Producer, TimeInterval._> + internal sealed class TimeInterval : Producer, TimeInterval._> { private readonly IObservable _source; private readonly IScheduler _scheduler; @@ -21,9 +21,9 @@ public TimeInterval(IObservable source, IScheduler scheduler) protected override void Run(_ sink) => sink.Run(this); - internal sealed class _ : Sink> + internal sealed class _ : Sink> { - public _(IObserver> observer) + public _(IObserver> observer) : base(observer) { } @@ -44,7 +44,7 @@ public override void OnNext(TSource value) var now = _watch.Elapsed; var span = now.Subtract(_last); _last = now; - ForwardOnNext(new System.Reactive.TimeInterval(value, span)); + ForwardOnNext(new Reactive.TimeInterval(value, span)); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ToObservable.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ToObservable.cs index 69fbe6847d..5bf2309b48 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/ToObservable.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/ToObservable.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Reactive.Concurrency; using System.Reactive.Disposables; -using System.Threading; namespace System.Reactive.Linq.ObservableImpl { @@ -26,9 +25,9 @@ public ToObservableRecursive(IEnumerable source, IScheduler scheduler) internal sealed class _ : IdentitySink { - IEnumerator _enumerator; + private IEnumerator _enumerator; - volatile bool _disposed; + private volatile bool _disposed; public _(IObserver observer) : base(observer) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Using.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Using.cs index 91436cd4a2..5177e04903 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Using.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Using.cs @@ -51,7 +51,7 @@ public void Run(Using parent) return; } - base.Run(source); + Run(source); } protected override void Dispose(bool disposing) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs index 284aa0e41d..3949cd296c 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs @@ -310,7 +310,7 @@ public void Run(IObservable first, IEnumerable second) return; } - base.Run(first); + Run(first); } protected override void Dispose(bool disposing) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/ObservableEx.cs b/Rx.NET/Source/src/System.Reactive/Linq/ObservableEx.cs index 5490691ad2..00dc6e1a89 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/ObservableEx.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/ObservableEx.cs @@ -12,7 +12,9 @@ namespace System.Reactive.Linq /// public static class ObservableEx { +#pragma warning disable IDE1006 // Naming Styles: 3rd party code is known to reflect for this specific field name private static IQueryLanguageEx s_impl = QueryServices.GetQueryImpl(new QueryLanguageEx()); +#pragma warning restore IDE1006 // Naming Styles #region Create diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Observable_.cs b/Rx.NET/Source/src/System.Reactive/Linq/Observable_.cs index bb08024af9..9c0c657b30 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Observable_.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Observable_.cs @@ -9,6 +9,8 @@ namespace System.Reactive.Linq /// public static partial class Observable { +#pragma warning disable IDE1006 // Naming Styles: 3rd party code is known to reflect for this specific field name private static IQueryLanguage s_impl = QueryServices.GetQueryImpl(new QueryLanguage()); +#pragma warning restore IDE1006 // Naming Styles } } diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Generated.cs b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Generated.cs index 7e7eaf0aa0..a1d64604ea 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Generated.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Generated.cs @@ -1,4 +1,4 @@ -/* +/* * WARNING: Auto-generated file (merged on 06/13/2018) * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory). */ @@ -11,7 +11,9 @@ using System.Linq.Expressions; using System.Reactive.Concurrency; using System.Reactive.Subjects; +#if !CRIPPLED_REFLECTION using System.Reflection; +#endif using System.Threading; using System.Threading.Tasks; diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs index 716decef24..545ee77775 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs @@ -8,7 +8,9 @@ using System.Linq; using System.Linq.Expressions; using System.Reactive.Joins; +#if !CRIPPLED_REFLECTION using System.Reflection; +#endif namespace System.Reactive.Linq { @@ -41,9 +43,9 @@ public static QueryablePattern And(this IQbservabl Expression.Call( null, #if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.And(default, default)), + InfoOf(() => And(default, default)), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight)), #endif left.Expression, GetSourceExpression(right) @@ -76,9 +78,9 @@ public static QueryablePlan Then(this IQbservable Qbservable.Then(default, default)), + InfoOf(() => Then(default, default)), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), #endif source.Expression, selector @@ -110,9 +112,9 @@ public static IQbservable When(this IQbservableProvider provid Expression.Call( null, #if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.When(default, default)), + InfoOf(() => When(default, default)), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), #endif Expression.Constant(provider, typeof(IQbservableProvider)), Expression.NewArrayInit( @@ -147,9 +149,9 @@ public static IQbservable When(this IQbservableProvider provid Expression.Call( null, #if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.When(default, default(IEnumerable>))), + InfoOf(() => When(default, default(IEnumerable>))), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), #endif Expression.Constant(provider, typeof(IQbservableProvider)), Expression.Constant(plans, typeof(IEnumerable>)) @@ -159,4 +161,4 @@ public static IQbservable When(this IQbservableProvider provid } } -#pragma warning restore 1591 \ No newline at end of file +#pragma warning restore 1591 diff --git a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.cs b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.cs index 8a19434102..124277e40b 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.cs @@ -54,9 +54,9 @@ public static IQbservable ToQbservable(this IQueryable Qbservable.ToQbservable(default)), + InfoOf(() => ToQbservable(default)), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), #endif source.Expression ) @@ -88,9 +88,9 @@ public static IQbservable ToQbservable(this IQueryable Qbservable.ToQbservable(default)), + InfoOf(() => ToQbservable(default)), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), #endif source.Expression, Expression.Constant(scheduler) diff --git a/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Generated.cs b/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Generated.cs index 3e239269a9..90c1ebb060 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Generated.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Generated.cs @@ -1,4 +1,4 @@ -/* +/* * WARNING: Auto-generated file (05/28/2018 22:20:19) * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory). */ @@ -8,7 +8,9 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reactive.Concurrency; +#if !CRIPPLED_REFLECTION using System.Reflection; +#endif namespace System.Reactive.Linq { diff --git a/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Creation.cs b/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Creation.cs index 2f7ce07999..f2d585318f 100644 --- a/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Creation.cs +++ b/Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Creation.cs @@ -23,16 +23,16 @@ public virtual IObservable Create(Func, IDi private sealed class CreateWithDisposableObservable : ObservableBase { - private readonly Func, IDisposable> subscribe; + private readonly Func, IDisposable> _subscribe; public CreateWithDisposableObservable(Func, IDisposable> subscribe) { - this.subscribe = subscribe; + _subscribe = subscribe; } protected override IDisposable SubscribeCore(IObserver observer) { - return subscribe(observer) ?? Disposable.Empty; + return _subscribe(observer) ?? Disposable.Empty; } } @@ -43,16 +43,16 @@ public virtual IObservable Create(Func, Act private sealed class CreateWithActionDisposable : ObservableBase { - private readonly Func, Action> subscribe; + private readonly Func, Action> _subscribe; public CreateWithActionDisposable(Func, Action> subscribe) { - this.subscribe = subscribe; + _subscribe = subscribe; } protected override IDisposable SubscribeCore(IObserver observer) { - var a = subscribe(observer); + var a = _subscribe(observer); return a != null ? Disposable.Create(a) : Disposable.Empty; } } @@ -68,18 +68,18 @@ public virtual IObservable Create(Func, Can private sealed class CreateWithTaskTokenObservable : ObservableBase { - private readonly Func, CancellationToken, Task> subscribeAsync; + private readonly Func, CancellationToken, Task> _subscribeAsync; public CreateWithTaskTokenObservable(Func, CancellationToken, Task> subscribeAsync) { - this.subscribeAsync = subscribeAsync; + _subscribeAsync = subscribeAsync; } protected override IDisposable SubscribeCore(IObserver observer) { var cancellable = new CancellationDisposable(); - var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable(); + var taskObservable = _subscribeAsync(observer, cancellable.Token).ToObservable(); var taskCompletionObserver = new TaskCompletionObserver(observer); var subscription = taskObservable.Subscribe(taskCompletionObserver); @@ -88,21 +88,21 @@ protected override IDisposable SubscribeCore(IObserver observer) private sealed class TaskCompletionObserver : IObserver { - private readonly IObserver observer; + private readonly IObserver _observer; public TaskCompletionObserver(IObserver observer) { - this.observer = observer; + _observer = observer; } public void OnCompleted() { - observer.OnCompleted(); + _observer.OnCompleted(); } public void OnError(Exception error) { - observer.OnError(error); + _observer.OnError(error); } public void OnNext(Unit value) @@ -124,18 +124,18 @@ public virtual IObservable Create(Func, Can private sealed class CreateWithTaskDisposable : ObservableBase { - private readonly Func, CancellationToken, Task> subscribeAsync; + private readonly Func, CancellationToken, Task> _subscribeAsync; public CreateWithTaskDisposable(Func, CancellationToken, Task> subscribeAsync) { - this.subscribeAsync = subscribeAsync; + _subscribeAsync = subscribeAsync; } protected override IDisposable SubscribeCore(IObserver observer) { var cancellable = new CancellationDisposable(); - var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable(); + var taskObservable = _subscribeAsync(observer, cancellable.Token).ToObservable(); var taskCompletionObserver = new TaskDisposeCompletionObserver(observer); @@ -150,32 +150,32 @@ protected override IDisposable SubscribeCore(IObserver observer) private sealed class TaskDisposeCompletionObserver : IObserver, IDisposable { - private readonly IObserver observer; - private IDisposable disposable; + private readonly IObserver _observer; + private IDisposable _disposable; public TaskDisposeCompletionObserver(IObserver observer) { - this.observer = observer; + _observer = observer; } public void Dispose() { - Disposable.TryDispose(ref disposable); + Disposable.TryDispose(ref _disposable); } public void OnCompleted() { - observer.OnCompleted(); + _observer.OnCompleted(); } public void OnError(Exception error) { - observer.OnError(error); + _observer.OnError(error); } public void OnNext(IDisposable value) { - Disposable.SetSingle(ref disposable, value); + Disposable.SetSingle(ref _disposable, value); } } } @@ -192,18 +192,18 @@ public virtual IObservable Create(Func, Can private sealed class CreateWithTaskActionObservable : ObservableBase { - private readonly Func, CancellationToken, Task> subscribeAsync; + private readonly Func, CancellationToken, Task> _subscribeAsync; public CreateWithTaskActionObservable(Func, CancellationToken, Task> subscribeAsync) { - this.subscribeAsync = subscribeAsync; + _subscribeAsync = subscribeAsync; } protected override IDisposable SubscribeCore(IObserver observer) { var cancellable = new CancellationDisposable(); - var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable(); + var taskObservable = _subscribeAsync(observer, cancellable.Token).ToObservable(); var taskCompletionObserver = new TaskDisposeCompletionObserver(observer); @@ -218,33 +218,33 @@ protected override IDisposable SubscribeCore(IObserver observer) private sealed class TaskDisposeCompletionObserver : IObserver, IDisposable { - private readonly IObserver observer; - private Action disposable; + private readonly IObserver _observer; + private Action _disposable; private static readonly Action DisposedAction = () => { }; public TaskDisposeCompletionObserver(IObserver observer) { - this.observer = observer; + _observer = observer; } public void Dispose() { - Interlocked.Exchange(ref disposable, DisposedAction)?.Invoke(); + Interlocked.Exchange(ref _disposable, DisposedAction)?.Invoke(); } public void OnCompleted() { - observer.OnCompleted(); + _observer.OnCompleted(); } public void OnError(Exception error) { - observer.OnError(error); + _observer.OnError(error); } public void OnNext(Action value) { - if (Interlocked.CompareExchange(ref disposable, value, null) != null) + if (Interlocked.CompareExchange(ref _disposable, value, null) != null) { value?.Invoke(); } diff --git a/Rx.NET/Source/src/System.Reactive/ListObservable.cs b/Rx.NET/Source/src/System.Reactive/ListObservable.cs index 2d57b39b4b..59fc8c2227 100644 --- a/Rx.NET/Source/src/System.Reactive/ListObservable.cs +++ b/Rx.NET/Source/src/System.Reactive/ListObservable.cs @@ -20,9 +20,9 @@ namespace System.Reactive [Experimental] public class ListObservable : IList, IObservable { - private readonly IDisposable subscription; - private readonly AsyncSubject subject = new AsyncSubject(); - private readonly List results = new List(); + private readonly IDisposable _subscription; + private readonly AsyncSubject _subject = new AsyncSubject(); + private readonly List _results = new List(); /// /// Constructs an object that retains the values of source and signals the end of the sequence. @@ -36,12 +36,12 @@ public ListObservable(IObservable source) throw new ArgumentNullException(nameof(source)); } - subscription = source.Subscribe(results.Add, subject.OnError, subject.OnCompleted); + _subscription = source.Subscribe(_results.Add, _subject.OnError, _subject.OnCompleted); } private void Wait() { - subject.DefaultIfEmpty().Wait(); + _subject.DefaultIfEmpty().Wait(); } /// @@ -53,12 +53,12 @@ public T Value { Wait(); - if (results.Count == 0) + if (_results.Count == 0) { throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS); } - return results[results.Count - 1]; + return _results[_results.Count - 1]; } } /// @@ -69,7 +69,7 @@ public T Value public int IndexOf(T item) { Wait(); - return results.IndexOf(item); + return _results.IndexOf(item); } /// @@ -80,7 +80,7 @@ public int IndexOf(T item) public void Insert(int index, T item) { Wait(); - results.Insert(index, item); + _results.Insert(index, item); } /// @@ -90,7 +90,7 @@ public void Insert(int index, T item) public void RemoveAt(int index) { Wait(); - results.RemoveAt(index); + _results.RemoveAt(index); } /// @@ -102,12 +102,12 @@ public T this[int index] get { Wait(); - return results[index]; + return _results[index]; } set { Wait(); - results[index] = value; + _results[index] = value; } } @@ -118,7 +118,7 @@ public T this[int index] public void Add(T item) { Wait(); - results.Add(item); + _results.Add(item); } /// @@ -127,7 +127,7 @@ public void Add(T item) public void Clear() { Wait(); - results.Clear(); + _results.Clear(); } /// @@ -138,7 +138,7 @@ public void Clear() public bool Contains(T item) { Wait(); - return results.Contains(item); + return _results.Contains(item); } /// @@ -149,7 +149,7 @@ public bool Contains(T item) public void CopyTo(T[] array, int arrayIndex) { Wait(); - results.CopyTo(array, arrayIndex); + _results.CopyTo(array, arrayIndex); } /// @@ -160,7 +160,7 @@ public int Count get { Wait(); - return results.Count; + return _results.Count; } } @@ -180,7 +180,7 @@ public bool IsReadOnly public bool Remove(T item) { Wait(); - return results.Remove(item); + return _results.Remove(item); } /// @@ -190,7 +190,7 @@ public bool Remove(T item) public IEnumerator GetEnumerator() { Wait(); - return results.GetEnumerator(); + return _results.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); @@ -208,7 +208,7 @@ public IDisposable Subscribe(IObserver observer) throw new ArgumentNullException(nameof(observer)); } - return StableCompositeDisposable.Create(subscription, subject.Subscribe(observer)); + return StableCompositeDisposable.Create(_subscription, _subject.Subscribe(observer)); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Notification.cs b/Rx.NET/Source/src/System.Reactive/Notification.cs index 3a7cc02991..f4a6e20c56 100644 --- a/Rx.NET/Source/src/System.Reactive/Notification.cs +++ b/Rx.NET/Source/src/System.Reactive/Notification.cs @@ -141,7 +141,7 @@ public override bool Equals(Notification other) /// /// Returns a string representation of this instance. /// - public override string ToString() => String.Format(CultureInfo.CurrentCulture, "OnNext({0})", Value); + public override string ToString() => string.Format(CultureInfo.CurrentCulture, "OnNext({0})", Value); /// /// Invokes the observer's method corresponding to the notification. @@ -296,7 +296,7 @@ public override bool Equals(Notification other) /// /// Returns a string representation of this instance. /// - public override string ToString() => String.Format(CultureInfo.CurrentCulture, "OnError({0})", Exception.GetType().FullName); + public override string ToString() => string.Format(CultureInfo.CurrentCulture, "OnError({0})", Exception.GetType().FullName); /// /// Invokes the observer's method corresponding to the notification. diff --git a/Rx.NET/Source/src/System.Reactive/ObservableQuery.cs b/Rx.NET/Source/src/System.Reactive/ObservableQuery.cs index 791bb1d336..2e9f65eead 100644 --- a/Rx.NET/Source/src/System.Reactive/ObservableQuery.cs +++ b/Rx.NET/Source/src/System.Reactive/ObservableQuery.cs @@ -71,18 +71,18 @@ IQueryable IQueryProvider.CreateQuery(Expression expression) return Expression.Lambda>>(res).Compile()(); } - private static MethodInfo s_AsQueryable; + private static MethodInfo _staticAsQueryable; private static MethodInfo AsQueryable { get { - if (s_AsQueryable == null) + if (_staticAsQueryable == null) { - s_AsQueryable = Qbservable.InfoOf(() => Queryable.AsQueryable(null)).GetGenericMethodDefinition(); + _staticAsQueryable = Qbservable.InfoOf(() => Queryable.AsQueryable(null)).GetGenericMethodDefinition(); } - return s_AsQueryable; + return _staticAsQueryable; } } diff --git a/Rx.NET/Source/src/System.Reactive/ObserverBase.cs b/Rx.NET/Source/src/System.Reactive/ObserverBase.cs index 22cf86e97d..734a958fbc 100644 --- a/Rx.NET/Source/src/System.Reactive/ObserverBase.cs +++ b/Rx.NET/Source/src/System.Reactive/ObserverBase.cs @@ -13,14 +13,14 @@ namespace System.Reactive /// The type of the elements in the sequence. public abstract class ObserverBase : IObserver, IDisposable { - private int isStopped; + private int _isStopped; /// /// Creates a new observer in a non-stopped state. /// protected ObserverBase() { - isStopped = 0; + _isStopped = 0; } /// @@ -29,7 +29,7 @@ protected ObserverBase() /// Next element in the sequence. public void OnNext(T value) { - if (Volatile.Read(ref isStopped) == 0) + if (Volatile.Read(ref _isStopped) == 0) { OnNextCore(value); } @@ -54,7 +54,7 @@ public void OnError(Exception error) throw new ArgumentNullException(nameof(error)); } - if (Interlocked.Exchange(ref isStopped, 1) == 0) + if (Interlocked.Exchange(ref _isStopped, 1) == 0) { OnErrorCore(error); } @@ -73,7 +73,7 @@ public void OnError(Exception error) /// public void OnCompleted() { - if (Interlocked.Exchange(ref isStopped, 1) == 0) + if (Interlocked.Exchange(ref _isStopped, 1) == 0) { OnCompletedCore(); } @@ -102,13 +102,13 @@ protected virtual void Dispose(bool disposing) { if (disposing) { - Volatile.Write(ref isStopped, 1); + Volatile.Write(ref _isStopped, 1); } } internal bool Fail(Exception error) { - if (Interlocked.Exchange(ref isStopped, 1) == 0) + if (Interlocked.Exchange(ref _isStopped, 1) == 0) { OnErrorCore(error); return true; diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs index 6887c7e0cd..ca37b760a0 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/ControlScheduler.cs @@ -21,7 +21,7 @@ public class ControlScheduler : LocalScheduler, ISchedulerPeriodic /// Windows Forms control to get the message loop from. /// is null. /// - /// This scheduler type is typically used indirectly through the and method overloads that take a Windows Forms control. + /// This scheduler type is typically used indirectly through the and method overloads that take a Windows Forms control. /// public ControlScheduler(Control control) { @@ -95,7 +95,7 @@ public override IDisposable Schedule(TState state, TimeSpan dueTime, Fun { var d = new MultipleAssignmentDisposable(); - var timer = new System.Windows.Forms.Timer(); + var timer = new Windows.Forms.Timer(); timer.Tick += (s, e) => { @@ -174,7 +174,7 @@ public IDisposable SchedulePeriodic(TState state, TimeSpan period, Func< var createTimer = new Func((scheduler1, state1) => { - var timer = new System.Windows.Forms.Timer(); + var timer = new Windows.Forms.Timer(); timer.Tick += (s, e) => { diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs index f12f9a15c2..d5c9a03e14 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Concurrency/DispatcherScheduler.cs @@ -9,27 +9,27 @@ namespace System.Reactive.Concurrency { /// - /// Represents an object that schedules units of work on a . + /// Represents an object that schedules units of work on a . /// /// - /// This scheduler type is typically used indirectly through the and methods that use the Dispatcher on the calling thread. + /// This scheduler type is typically used indirectly through the and methods that use the Dispatcher on the calling thread. /// public class DispatcherScheduler : LocalScheduler, ISchedulerPeriodic { /// - /// Gets the scheduler that schedules work on the current . + /// Gets the scheduler that schedules work on the current . /// [Obsolete(Constants_WindowsThreading.OBSOLETE_INSTANCE_PROPERTY)] - public static DispatcherScheduler Instance => new DispatcherScheduler(System.Windows.Threading.Dispatcher.CurrentDispatcher); + public static DispatcherScheduler Instance => new DispatcherScheduler(Windows.Threading.Dispatcher.CurrentDispatcher); /// - /// Gets the scheduler that schedules work on the for the current thread. + /// Gets the scheduler that schedules work on the for the current thread. /// public static DispatcherScheduler Current { get { - var dispatcher = System.Windows.Threading.Dispatcher.FromThread(Thread.CurrentThread); + var dispatcher = Windows.Threading.Dispatcher.FromThread(Thread.CurrentThread); if (dispatcher == null) { throw new InvalidOperationException(Strings_WindowsThreading.NO_DISPATCHER_CURRENT_THREAD); @@ -40,11 +40,11 @@ public static DispatcherScheduler Current } /// - /// Constructs a that schedules units of work on the given . + /// Constructs a that schedules units of work on the given . /// /// to schedule work on. /// is null. - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) + public DispatcherScheduler(Windows.Threading.Dispatcher dispatcher) { Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); Priority = Windows.Threading.DispatcherPriority.Normal; @@ -52,26 +52,26 @@ public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) } /// - /// Constructs a that schedules units of work on the given at the given priority. + /// Constructs a that schedules units of work on the given at the given priority. /// /// to schedule work on. /// Priority at which units of work are scheduled. /// is null. - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher, System.Windows.Threading.DispatcherPriority priority) + public DispatcherScheduler(Windows.Threading.Dispatcher dispatcher, Windows.Threading.DispatcherPriority priority) { Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); Priority = priority; } /// - /// Gets the associated with the . + /// Gets the associated with the . /// - public System.Windows.Threading.Dispatcher Dispatcher { get; } + public Windows.Threading.Dispatcher Dispatcher { get; } /// /// Gets the priority at which work items will be dispatched. /// - public System.Windows.Threading.DispatcherPriority Priority { get; } + public Windows.Threading.DispatcherPriority Priority { get; } /// /// Schedules an action to be executed on the dispatcher. @@ -105,7 +105,7 @@ public override IDisposable Schedule(TState state, Func - /// Schedules an action to be executed after on the dispatcher, using a object. + /// Schedules an action to be executed after on the dispatcher, using a object. /// /// The type of the state passed to the scheduled action. /// State passed to the action to be executed. @@ -133,7 +133,7 @@ private IDisposable ScheduleSlow(TState state, TimeSpan dueTime, Func { @@ -169,7 +169,7 @@ private IDisposable ScheduleSlow(TState state, TimeSpan dueTime, Func - /// Schedules a periodic piece of work on the dispatcher, using a object. + /// Schedules a periodic piece of work on the dispatcher, using a object. /// /// The type of the state passed to the scheduled action. /// Initial state passed to the action upon the first iteration. @@ -190,7 +190,7 @@ public IDisposable SchedulePeriodic(TState state, TimeSpan period, Func< throw new ArgumentNullException(nameof(action)); } - var timer = new System.Windows.Threading.DispatcherTimer(Priority, Dispatcher); + var timer = new Windows.Threading.DispatcherTimer(Priority, Dispatcher); var state1 = state; diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs index 5529f2f461..25322ac913 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/ControlObservable.cs @@ -22,7 +22,7 @@ public static class ControlObservable /// or is null. /// /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified control. - /// In order to invoke observer callbacks on the specified control, e.g. to render results in a control, use . + /// In order to invoke observer callbacks on the specified control, e.g. to render results in a control, use . /// public static IObservable SubscribeOn(this IObservable source, Control control) { diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs index cdb3536302..fcf239ddac 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/DispatcherObservable.cs @@ -35,7 +35,7 @@ public static IObservable ObserveOn(this IObservable throw new ArgumentNullException(nameof(dispatcher)); } - return ObserveOn_(source, dispatcher); + return ObserveOn_(source, dispatcher); } /// @@ -59,7 +59,7 @@ public static IObservable ObserveOn(this IObservable throw new ArgumentNullException(nameof(dispatcher)); } - return ObserveOn_(source, dispatcher, priority); + return ObserveOn_(source, dispatcher, priority); } /// @@ -82,7 +82,7 @@ public static IObservable ObserveOn(this IObservable throw new ArgumentNullException(nameof(scheduler)); } - return ObserveOn_(source, scheduler.Dispatcher, scheduler.Priority); + return ObserveOn_(source, scheduler.Dispatcher, scheduler.Priority); } @@ -106,7 +106,7 @@ public static IObservable ObserveOn(this IObservable throw new ArgumentNullException(nameof(dispatcherObject)); } - return ObserveOn_(source, dispatcherObject.Dispatcher); + return ObserveOn_(source, dispatcherObject.Dispatcher); } /// @@ -130,7 +130,7 @@ public static IObservable ObserveOn(this IObservable throw new ArgumentNullException(nameof(dispatcherObject)); } - return ObserveOn_(source, dispatcherObject.Dispatcher, priority); + return ObserveOn_(source, dispatcherObject.Dispatcher, priority); } @@ -148,7 +148,7 @@ public static IObservable ObserveOnDispatcher(this IObservable throw new ArgumentNullException(nameof(source)); } - return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher); + return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher); } /// @@ -166,7 +166,7 @@ public static IObservable ObserveOnDispatcher(this IObservable throw new ArgumentNullException(nameof(source)); } - return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher, priority); + return ObserveOn_(source, DispatcherScheduler.Current.Dispatcher, priority); } private static IObservable ObserveOn_(IObservable source, Dispatcher dispatcher, DispatcherPriority priority) @@ -208,7 +208,7 @@ public static IObservable SubscribeOn(this IObservable(source, dispatcher); + return SubscribeOn_(source, dispatcher); } /// @@ -236,7 +236,7 @@ public static IObservable SubscribeOn(this IObservable(source, dispatcher, priority); + return SubscribeOn_(source, dispatcher, priority); } @@ -264,7 +264,7 @@ public static IObservable SubscribeOn(this IObservable(source, scheduler.Dispatcher, scheduler.Priority); + return SubscribeOn_(source, scheduler.Dispatcher, scheduler.Priority); } /// @@ -291,7 +291,7 @@ public static IObservable SubscribeOn(this IObservable(source, dispatcherObject.Dispatcher); + return SubscribeOn_(source, dispatcherObject.Dispatcher); } /// @@ -319,7 +319,7 @@ public static IObservable SubscribeOn(this IObservable(source, dispatcherObject.Dispatcher, priority); + return SubscribeOn_(source, dispatcherObject.Dispatcher, priority); } /// @@ -340,7 +340,7 @@ public static IObservable SubscribeOnDispatcher(this IObservab throw new ArgumentNullException(nameof(source)); } - return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher); + return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher); } /// @@ -362,7 +362,7 @@ public static IObservable SubscribeOnDispatcher(this IObservab throw new ArgumentNullException(nameof(source)); } - return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher, priority); + return SubscribeOn_(source, DispatcherScheduler.Current.Dispatcher, priority); } private static IObservable SubscribeOn_(IObservable source, Dispatcher dispatcher, DispatcherPriority priority) diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs index 926b7b98d7..da38c0236a 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/Observable.Remoting.cs @@ -23,7 +23,7 @@ public static partial class RemotingObservable /// Source sequence. /// The observable sequence that supports remote subscriptions. /// is null. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] + [Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] public static IObservable Remotable(this IObservable source) { if (source == null) @@ -31,7 +31,7 @@ public static IObservable Remotable(this IObservable throw new ArgumentNullException(nameof(source)); } - return Remotable_(source); + return Remotable_(source); } /// @@ -42,7 +42,7 @@ public static IObservable Remotable(this IObservable /// Lease object to control lifetime of the remotable sequence. Notice null is a supported value. /// The observable sequence that supports remote subscriptions. /// is null. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] + [Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] public static IObservable Remotable(this IObservable source, ILease lease) { if (source == null) @@ -50,7 +50,7 @@ public static IObservable Remotable(this IObservable throw new ArgumentNullException(nameof(source)); } - return Remotable_(source, lease); + return Remotable_(source, lease); } /// @@ -60,7 +60,7 @@ public static IObservable Remotable(this IObservable /// Source sequence. /// The observable sequence that supports remote subscriptions. /// is null. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] + [Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] public static IQbservable Remotable(this IQbservable source) { if (source == null) @@ -74,7 +74,7 @@ public static IQbservable Remotable(this IQbservable #if CRIPPLED_REFLECTION InfoOf(() => RemotingObservable.Remotable(default(IQbservable))), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), #endif source.Expression ) @@ -89,7 +89,7 @@ public static IQbservable Remotable(this IQbservable /// Lease object to control lifetime of the remotable sequence. Notice null is a supported value. /// The observable sequence that supports remote subscriptions. /// is null. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] + [Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")] public static IQbservable Remotable(this IQbservable source, ILease lease) { if (source == null) @@ -103,7 +103,7 @@ public static IQbservable Remotable(this IQbservable #if CRIPPLED_REFLECTION InfoOf(() => RemotingObservable.Remotable(default(IQbservable), default(ILease))), #else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), #endif source.Expression, Expression.Constant(lease, typeof(ILease)) diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs index 206c025ee0..58a6b91bfb 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/Desktop/Linq/QueryLanguage.Remoting.cs @@ -76,11 +76,11 @@ private static IObservable Remotable_(IObservable sou [Serializable] private class SerializableObservable : IObservable { - private readonly RemotableObservable remotableObservable; + private readonly RemotableObservable _remotableObservable; public SerializableObservable(RemotableObservable remotableObservable) { - this.remotableObservable = remotableObservable; + _remotableObservable = remotableObservable; } public IDisposable Subscribe(IObserver observer) @@ -90,7 +90,7 @@ public IDisposable Subscribe(IObserver observer) // // [OK] Use of unsafe Subscribe: non-pretentious transparent wrapping through remoting; exception coming from the remote object is not re-routed. // - var d = remotableObservable.Subscribe/*Unsafe*/(new RemotableObserver(consumer)); + var d = _remotableObservable.Subscribe/*Unsafe*/(new RemotableObserver(consumer)); consumer.SetResource(d); @@ -100,23 +100,23 @@ public IDisposable Subscribe(IObserver observer) private class RemotableObserver : MarshalByRefObject, IObserver, ISponsor { - private readonly IObserver underlyingObserver; + private readonly IObserver _underlyingObserver; public RemotableObserver(IObserver underlyingObserver) { - this.underlyingObserver = underlyingObserver; + _underlyingObserver = underlyingObserver; } public void OnNext(T value) { - underlyingObserver.OnNext(value); + _underlyingObserver.OnNext(value); } public void OnError(Exception exception) { try { - underlyingObserver.OnError(exception); + _underlyingObserver.OnError(exception); } finally { @@ -128,7 +128,7 @@ public void OnCompleted() { try { - underlyingObserver.OnCompleted(); + _underlyingObserver.OnCompleted(); } finally { @@ -164,13 +164,13 @@ TimeSpan ISponsor.Renewal(ILease lease) [Serializable] private sealed class RemotableObservable : MarshalByRefObject, IObservable { - private readonly IObservable underlyingObservable; - private readonly ILease lease; + private readonly IObservable _underlyingObservable; + private readonly ILease _lease; public RemotableObservable(IObservable underlyingObservable, ILease lease) { - this.underlyingObservable = underlyingObservable; - this.lease = lease; + _underlyingObservable = underlyingObservable; + _lease = lease; } public IDisposable Subscribe(IObserver observer) @@ -178,22 +178,22 @@ public IDisposable Subscribe(IObserver observer) // // [OK] Use of unsafe Subscribe: non-pretentious transparent wrapping through remoting; throwing across remoting boundaries is fine. // - return new RemotableSubscription(underlyingObservable.Subscribe/*Unsafe*/(observer)); + return new RemotableSubscription(_underlyingObservable.Subscribe/*Unsafe*/(observer)); } [SecurityCritical] public override object InitializeLifetimeService() { - return lease; + return _lease; } private sealed class RemotableSubscription : MarshalByRefObject, IDisposable, ISponsor { - private IDisposable underlyingSubscription; + private IDisposable _underlyingSubscription; public RemotableSubscription(IDisposable underlyingSubscription) { - this.underlyingSubscription = underlyingSubscription; + _underlyingSubscription = underlyingSubscription; } public void Dispose() @@ -201,7 +201,7 @@ public void Dispose() // // Avoiding double-dispose and dropping the reference upon disposal. // - using (Interlocked.Exchange(ref underlyingSubscription, Disposable.Empty)) + using (Interlocked.Exchange(ref _underlyingSubscription, Disposable.Empty)) { Unregister(); } diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs index dc8c292ccd..58cb0aecb8 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Concurrency/CoreDispatcherScheduler.cs @@ -15,7 +15,7 @@ namespace System.Reactive.Concurrency /// Represents an object that schedules units of work on a . /// /// - /// This scheduler type is typically used indirectly through the and methods that use the current Dispatcher. + /// This scheduler type is typically used indirectly through the and methods that use the current Dispatcher. /// [CLSCompliant(false)] public sealed class CoreDispatcherScheduler : LocalScheduler, ISchedulerPeriodic diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs index cfdba40cb3..feff3a6dcf 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Linq/WindowsObservable.Events.cs @@ -22,7 +22,7 @@ public static partial class WindowsObservable /// Action that detaches the given event handler from the underlying .NET event. /// The observable sequence that contains data representations of invocations of the underlying typed event. /// or is null. - /// + /// public static IObservable> FromEventPattern(Action> addHandler, Action> removeHandler) { if (addHandler == null) @@ -62,7 +62,7 @@ public static IObservable> FromEventPatternAction that detaches the given event handler from the underlying .NET event. /// The observable sequence that contains data representations of invocations of the underlying typed event. /// or or is null. - /// + /// public static IObservable> FromEventPattern(Func, TDelegate> conversion, Action addHandler, Action removeHandler) { if (conversion == null) @@ -115,4 +115,4 @@ public static IEventPatternSource ToEventPattern private sealed class AsyncSubjectDisposable : IDisposable { - internal readonly IObserver downstream; - private AsyncSubject parent; + internal readonly IObserver Downstream; + private AsyncSubject _parent; public AsyncSubjectDisposable(AsyncSubject parent, IObserver downstream) { - this.parent = parent; - this.downstream = downstream; + _parent = parent; + Downstream = downstream; } public void Dispose() { - Interlocked.Exchange(ref parent, null)?.Remove(this); + Interlocked.Exchange(ref _parent, null)?.Remove(this); } internal bool IsDisposed() { - return Volatile.Read(ref parent) == null; + return Volatile.Read(ref _parent) == null; } } diff --git a/Rx.NET/Source/src/System.Reactive/TimeInterval.cs b/Rx.NET/Source/src/System.Reactive/TimeInterval.cs index 4029b31632..e28ba2de9c 100644 --- a/Rx.NET/Source/src/System.Reactive/TimeInterval.cs +++ b/Rx.NET/Source/src/System.Reactive/TimeInterval.cs @@ -101,7 +101,7 @@ public override int GetHashCode() /// String representation of the current value. public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Interval); + return string.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Interval); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Timestamped.cs b/Rx.NET/Source/src/System.Reactive/Timestamped.cs index 3435c733a0..78e86fcf90 100644 --- a/Rx.NET/Source/src/System.Reactive/Timestamped.cs +++ b/Rx.NET/Source/src/System.Reactive/Timestamped.cs @@ -102,7 +102,7 @@ public override int GetHashCode() /// String representation of the current value. public override string ToString() { - return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Timestamp); + return string.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Timestamp); } } From 7caaa0f18e35ed11e544edf3c886e52170410118 Mon Sep 17 00:00:00 2001 From: "Daniel C. Weber" Date: Mon, 2 Jul 2018 10:40:11 +0200 Subject: [PATCH 2/3] Fixed some missed conflict resolutions. --- .../src/System.Reactive/Concurrency/Scheduler.Recursive.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs index 11d154285d..bac60eba4a 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs @@ -206,7 +206,7 @@ internal void InvokeNext(TState state) var sad = new SingleAssignmentDisposable(); Group.Add(sad); - sad.Disposable = scheduler.ScheduleAction((state, sad, @this: this), nextState => + sad.Disposable = Scheduler.ScheduleAction((state, sad, @this: this), nextState => { nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); @@ -235,7 +235,7 @@ internal void InvokeNext(TState state, TimeSpan time) var sad = new SingleAssignmentDisposable(); Group.Add(sad); - sad.Disposable = scheduler.ScheduleAction((state, sad, @this: this), time, nextState => { + sad.Disposable = Scheduler.ScheduleAction((state, sad, @this: this), time, nextState => { nextState.@this.group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); }); @@ -263,7 +263,7 @@ internal void InvokeNext(TState state, DateTimeOffset dtOffset) var sad = new SingleAssignmentDisposable(); Group.Add(sad); - sad.Disposable = scheduler.ScheduleAction((state, sad, @this: this), dtOffset, nextState => { + sad.Disposable = Scheduler.ScheduleAction((state, sad, @this: this), dtOffset, nextState => { nextState.@this.group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); }); From 86636392b2875f0a6b45409dd09acf5df8a9b34f Mon Sep 17 00:00:00 2001 From: "Daniel C. Weber" Date: Mon, 2 Jul 2018 10:57:08 +0200 Subject: [PATCH 3/3] Fix more missed out conflict resolutions. --- .../src/System.Reactive/Concurrency/Scheduler.Recursive.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs index bac60eba4a..934a0318e0 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Recursive.cs @@ -236,7 +236,7 @@ internal void InvokeNext(TState state, TimeSpan time) Group.Add(sad); sad.Disposable = Scheduler.ScheduleAction((state, sad, @this: this), time, nextState => { - nextState.@this.group.Remove(nextState.sad); + nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); }); } @@ -264,7 +264,7 @@ internal void InvokeNext(TState state, DateTimeOffset dtOffset) Group.Add(sad); sad.Disposable = Scheduler.ScheduleAction((state, sad, @this: this), dtOffset, nextState => { - nextState.@this.group.Remove(nextState.sad); + nextState.@this.Group.Remove(nextState.sad); nextState.@this.InvokeFirst(nextState.state); }); }