From 1b11e79ee5ee517e545ccf2e4c8db5273afb4590 Mon Sep 17 00:00:00 2001 From: marodev Date: Thu, 20 May 2021 22:23:00 +0200 Subject: [PATCH 1/3] Fix ReSharper's "UseNullPropagation" --- .../System/Reactive/Concurrency/AsyncScheduler.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/AsyncRx.NET/System.Reactive.Async.Concurrency/System/Reactive/Concurrency/AsyncScheduler.cs b/AsyncRx.NET/System.Reactive.Async.Concurrency/System/Reactive/Concurrency/AsyncScheduler.cs index c3afb6c27b..455f4c2ac3 100644 --- a/AsyncRx.NET/System.Reactive.Async.Concurrency/System/Reactive/Concurrency/AsyncScheduler.cs +++ b/AsyncRx.NET/System.Reactive.Async.Concurrency/System/Reactive/Concurrency/AsyncScheduler.cs @@ -231,10 +231,7 @@ public void GetResult() throw new InvalidOperationException(); // REVIEW: No support for blocking. } - if (_error != null) - { - _error.Throw(); - } + _error?.Throw(); } public void OnCompleted(Action continuation) From dcbe78325458f2b0b0a5e8643e356e50a28303dd Mon Sep 17 00:00:00 2001 From: marodev Date: Thu, 20 May 2021 22:26:36 +0200 Subject: [PATCH 2/3] Fix ReSharper's "UseNullPropagation" --- .../System/Linq/AsyncEnumerableRewriter.cs | 5 +---- Ix.NET/Source/System.Linq.Async/System/Linq/Disposables.cs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs b/Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs index 76266a4503..fcf7135680 100644 --- a/Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs +++ b/Ix.NET/Source/System.Linq.Async.Queryable/System/Linq/AsyncEnumerableRewriter.cs @@ -291,10 +291,7 @@ private static ReadOnlyCollection FixupQuotedArgs(MethodInfo method, } } - if (list != null) - { - list.Add(expression); - } + list?.Add(expression); } // diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Disposables.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Disposables.cs index 7b7e514230..8fccaed589 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Disposables.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Disposables.cs @@ -47,10 +47,7 @@ public void Dispose() d1.Dispose(); var d2 = Interlocked.Exchange(ref _d2, null); - if (d2 != null) - { - d2.Dispose(); - } + d2?.Dispose(); } } } From a017496e53e26d81676de970b78a798f40f24a2a Mon Sep 17 00:00:00 2001 From: marodev Date: Thu, 20 May 2021 22:55:18 +0200 Subject: [PATCH 3/3] Fix ReSharper's "UseNullPropagation" --- .../System.Interactive/System/Linq/Operators/Publish.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs b/Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs index 1bd4b2c015..6ed44021ab 100644 --- a/Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs +++ b/Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs @@ -191,10 +191,7 @@ private IEnumerator GetEnumeratorCore(int i) } finally { - if (_buffer != null) - { - _buffer.Done(i + 1); - } + _buffer?.Done(i + 1); } } }