From db5428b9125218641e547049d308455dcda4186f Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 24 Sep 2020 10:51:45 -0700 Subject: [PATCH] Fixes for 'delegate can be simplified.' --- test/Autofac.Test/Util/AsyncDisposeTracker.cs | 10 ++-------- test/Autofac.Test/Util/AsyncOnlyDisposeTracker.cs | 5 +---- test/Autofac.Test/Util/DisposeTracker.cs | 5 +---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/test/Autofac.Test/Util/AsyncDisposeTracker.cs b/test/Autofac.Test/Util/AsyncDisposeTracker.cs index 5089586b7..9b1feb12c 100644 --- a/test/Autofac.Test/Util/AsyncDisposeTracker.cs +++ b/test/Autofac.Test/Util/AsyncDisposeTracker.cs @@ -15,10 +15,7 @@ public void Dispose() { IsSyncDisposed = true; - if (Disposing != null) - { - Disposing(this, EventArgs.Empty); - } + Disposing?.Invoke(this, EventArgs.Empty); } public async ValueTask DisposeAsync() @@ -27,10 +24,7 @@ public async ValueTask DisposeAsync() IsAsyncDisposed = true; - if (Disposing != null) - { - Disposing(this, EventArgs.Empty); - } + Disposing?.Invoke(this, EventArgs.Empty); } } } diff --git a/test/Autofac.Test/Util/AsyncOnlyDisposeTracker.cs b/test/Autofac.Test/Util/AsyncOnlyDisposeTracker.cs index bd63546ca..a60d85faa 100644 --- a/test/Autofac.Test/Util/AsyncOnlyDisposeTracker.cs +++ b/test/Autofac.Test/Util/AsyncOnlyDisposeTracker.cs @@ -15,10 +15,7 @@ public async ValueTask DisposeAsync() IsAsyncDisposed = true; - if (Disposing != null) - { - Disposing(this, EventArgs.Empty); - } + Disposing?.Invoke(this, EventArgs.Empty); } } } diff --git a/test/Autofac.Test/Util/DisposeTracker.cs b/test/Autofac.Test/Util/DisposeTracker.cs index 1a9407565..25f7d30b5 100644 --- a/test/Autofac.Test/Util/DisposeTracker.cs +++ b/test/Autofac.Test/Util/DisposeTracker.cs @@ -12,10 +12,7 @@ public void Dispose() { IsDisposed = true; - if (Disposing != null) - { - Disposing(this, EventArgs.Empty); - } + Disposing?.Invoke(this, EventArgs.Empty); } } }