diff --git a/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs b/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs index fc7c0587d..a85d20e40 100644 --- a/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs +++ b/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs @@ -64,8 +64,7 @@ internal class ManagedLoadContext : AssemblyLoadContext bool shadowCopyNativeLibraries) : base(Path.GetFileNameWithoutExtension(mainAssemblyPath), isCollectible) { - if (resourceProbingPaths == null) - throw new ArgumentNullException(nameof(resourceProbingPaths)); + ArgumentNullException.ThrowIfNull(resourceProbingPaths); this.mainAssemblyPath = mainAssemblyPath ?? throw new ArgumentNullException(nameof(mainAssemblyPath)); this.dependencyResolver = new AssemblyDependencyResolver(mainAssemblyPath); diff --git a/Dalamud/Plugin/Internal/Loader/PluginLoader.cs b/Dalamud/Plugin/Internal/Loader/PluginLoader.cs index d8b569356..a77bfe088 100644 --- a/Dalamud/Plugin/Internal/Loader/PluginLoader.cs +++ b/Dalamud/Plugin/Internal/Loader/PluginLoader.cs @@ -53,8 +53,7 @@ internal class PluginLoader : IDisposable /// A loader. public static PluginLoader CreateFromAssemblyFile(string assemblyFile, Action configure) { - if (configure == null) - throw new ArgumentNullException(nameof(configure)); + ArgumentNullException.ThrowIfNull(configure); var config = new LoaderConfig(assemblyFile); configure(config); diff --git a/Dalamud/Utility/ArrayExtensions.cs b/Dalamud/Utility/ArrayExtensions.cs index 5b6ce2332..5444468c6 100644 --- a/Dalamud/Utility/ArrayExtensions.cs +++ b/Dalamud/Utility/ArrayExtensions.cs @@ -115,8 +115,7 @@ internal static class ArrayExtensions if (count < 0 || startIndex > list.Count - count) throw new ArgumentOutOfRangeException(nameof(count), count, null); - if (match == null) - throw new ArgumentNullException(nameof(match)); + ArgumentNullException.ThrowIfNull(match); var endIndex = startIndex + count; for (var i = startIndex; i < endIndex; i++) @@ -138,8 +137,7 @@ internal static class ArrayExtensions /// public static int FindLastIndex(this IReadOnlyList list, int startIndex, int count, Predicate match) { - if (match == null) - throw new ArgumentNullException(nameof(match)); + ArgumentNullException.ThrowIfNull(match); if (list.Count == 0) {