diff --git a/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerOperation.cs b/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerOperation.cs index 22404303c..24ab76a8d 100644 --- a/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerOperation.cs +++ b/Rx.NET/Source/src/System.Reactive/Concurrency/SchedulerOperation.cs @@ -151,9 +151,7 @@ private void Cancel() if (w != null) w.Dispose(); - var c = _continuation; - if (c != null) - c(); + _continuation?.Invoke(); } } } \ No newline at end of file diff --git a/Rx.NET/Source/src/System.Reactive/Disposables/AnonymousDisposable.cs b/Rx.NET/Source/src/System.Reactive/Disposables/AnonymousDisposable.cs index 99b1e8237..0e0a1f5e8 100644 --- a/Rx.NET/Source/src/System.Reactive/Disposables/AnonymousDisposable.cs +++ b/Rx.NET/Source/src/System.Reactive/Disposables/AnonymousDisposable.cs @@ -37,11 +37,7 @@ public bool IsDisposed /// public void Dispose() { - var dispose = Interlocked.Exchange(ref _dispose, null); - if (dispose != null) - { - dispose(); - } + Interlocked.Exchange(ref _dispose, null)?.Invoke(); } } } diff --git a/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs b/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs index e6b2f1949..dc484e85a 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/HostLifecycleService.cs @@ -62,16 +62,12 @@ public static void Release() private static void OnSuspending(object sender, HostSuspendingEventArgs e) { - var suspending = Suspending; - if (suspending != null) - suspending(sender, e); + Suspending?.Invoke(sender, e); } private static void OnResuming(object sender, HostResumingEventArgs e) { - var resuming = Resuming; - if (resuming != null) - resuming(sender, e); + Resuming?.Invoke(sender, e); } private static IHostLifecycleNotifications InitializeNotifications() diff --git a/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.Default.cs b/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.Default.cs index b8a433fe7..2c37a5cfd 100644 --- a/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.Default.cs +++ b/Rx.NET/Source/src/System.Reactive/Internal/SystemClock.Default.cs @@ -100,9 +100,7 @@ private void TimeChanged() var diff = now - (_lastTime + _period); if (Math.Abs(diff.TotalMilliseconds) >= MAXERROR) { - var scc = _systemClockChanged; - if (scc != null) - scc(this, new SystemClockChangedEventArgs(_lastTime + _period, now)); + _systemClockChanged?.Invoke(this, new SystemClockChangedEventArgs(_lastTime + _period, now)); NewTimer(); } diff --git a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs index 58de5b01e..1104b0649 100644 --- a/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs +++ b/Rx.NET/Source/src/System.Reactive/Platforms/UWP/Foundation/AsyncInfoToObservableBridge.cs @@ -22,17 +22,14 @@ public AsyncInfoToObservableBridge(IAsyncInfo info, Action(); - if (onProgress != null) + onProgress?.Invoke(info, (iai, p) => { - onProgress(info, (iai, p) => - { - if (multiValue && getResult != null) - _subject.OnNext(getResult(iai)); + if (multiValue && getResult != null) + _subject.OnNext(getResult(iai)); - if (progress != null) - progress.Report(p); - }); - } + if (progress != null) + progress.Report(p); + }); Done(info, info.Status, true); }