Skip to content

Commit

Permalink
refactor: Use ArgumentNullException throw helper
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 committed May 18, 2024
1 parent 6242e6c commit f02e115
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/Core/Configuration/CPluginJsonConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public class CPluginJsonConfiguration : CPluginConfigurationBase
/// </exception>
public CPluginJsonConfiguration(IConfiguration configuration)
{
if(configuration is null)
throw new ArgumentNullException(nameof(configuration));

ArgumentNullException.ThrowIfNull(configuration);
_configuration = configuration;
}

Expand Down
3 changes: 1 addition & 2 deletions src/Core/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public static class PluginLoader
/// </exception>
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)
Expand Down
3 changes: 1 addition & 2 deletions src/Core/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ internal static IServiceCollection AddSubtypesOf<TSupertype>(
IEnumerable<Assembly> assemblies,
ServiceLifetime serviceLifetime) where TSupertype : class
{
if (assemblies is null)
throw new ArgumentNullException(nameof(assemblies));
ArgumentNullException.ThrowIfNull(assemblies);

foreach (Assembly assembly in assemblies)
{
Expand Down
4 changes: 1 addition & 3 deletions src/Core/TypeFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public static IEnumerable<TSupertype> FindSubtypesOf<TSupertype>() where TSupert
internal static IEnumerable<TSupertype> FindSubtypesOf<TSupertype>(IEnumerable<Assembly> assemblies)
where TSupertype : class
{
if (assemblies is null)
throw new ArgumentNullException(nameof(assemblies));

ArgumentNullException.ThrowIfNull(assemblies);
return GetSubtypesOf<TSupertype>(assemblies);
}

Expand Down

0 comments on commit f02e115

Please sign in to comment.