diff --git a/src/Core/Configuration/CPluginJsonConfiguration.cs b/src/Core/Configuration/CPluginJsonConfiguration.cs index 49e3e6e..9f124c3 100644 --- a/src/Core/Configuration/CPluginJsonConfiguration.cs +++ b/src/Core/Configuration/CPluginJsonConfiguration.cs @@ -30,9 +30,7 @@ public class CPluginJsonConfiguration : CPluginConfigurationBase /// public CPluginJsonConfiguration(IConfiguration configuration) { - if(configuration is null) - throw new ArgumentNullException(nameof(configuration)); - + ArgumentNullException.ThrowIfNull(configuration); _configuration = configuration; } diff --git a/src/Core/PluginLoader.cs b/src/Core/PluginLoader.cs index 93e6df1..5c002ef 100644 --- a/src/Core/PluginLoader.cs +++ b/src/Core/PluginLoader.cs @@ -31,8 +31,7 @@ public static class PluginLoader /// public static void Load(CPluginConfigurationBase configuration) { - if (configuration is null) - throw new ArgumentNullException(nameof(configuration)); + ArgumentNullException.ThrowIfNull(configuration); var assemblyFiles = configuration.GetPluginFiles(); foreach (string assemblyFile in assemblyFiles) diff --git a/src/Core/ServiceCollectionExtensions.cs b/src/Core/ServiceCollectionExtensions.cs index 0b763a9..8c017e7 100644 --- a/src/Core/ServiceCollectionExtensions.cs +++ b/src/Core/ServiceCollectionExtensions.cs @@ -40,8 +40,7 @@ internal static IServiceCollection AddSubtypesOf( IEnumerable assemblies, ServiceLifetime serviceLifetime) where TSupertype : class { - if (assemblies is null) - throw new ArgumentNullException(nameof(assemblies)); + ArgumentNullException.ThrowIfNull(assemblies); foreach (Assembly assembly in assemblies) { diff --git a/src/Core/TypeFinder.cs b/src/Core/TypeFinder.cs index 2e740eb..db64a82 100644 --- a/src/Core/TypeFinder.cs +++ b/src/Core/TypeFinder.cs @@ -36,9 +36,7 @@ public static IEnumerable FindSubtypesOf() where TSupert internal static IEnumerable FindSubtypesOf(IEnumerable assemblies) where TSupertype : class { - if (assemblies is null) - throw new ArgumentNullException(nameof(assemblies)); - + ArgumentNullException.ThrowIfNull(assemblies); return GetSubtypesOf(assemblies); }