diff options
author | vnugent <public@vaughnnugent.com> | 2024-01-13 22:42:13 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-01-13 22:42:13 -0500 |
commit | 299c41bf07d22daf7a6707bf2d485193c0ef61b8 (patch) | |
tree | c77740a12e74689ed637bf177c3cc78aa0672e92 /lib/Utils/src/Resources | |
parent | ddead3ab60254fcc1c8029715e094480da51dcd0 (diff) |
using new exception api
Diffstat (limited to 'lib/Utils/src/Resources')
-rw-r--r-- | lib/Utils/src/Resources/ManagedLibrary.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Utils/src/Resources/ManagedLibrary.cs b/lib/Utils/src/Resources/ManagedLibrary.cs index 56835c7..786a22d 100644 --- a/lib/Utils/src/Resources/ManagedLibrary.cs +++ b/lib/Utils/src/Resources/ManagedLibrary.cs @@ -189,7 +189,7 @@ namespace VNLib.Utils.Resources /// <exception cref="FileNotFoundException"></exception> public static ManagedLibrary LoadManagedAssembly(string assemblyName, AssemblyLoadContext loadContext) { - _ = loadContext ?? throw new ArgumentNullException(nameof(loadContext)); + ArgumentNullException.ThrowIfNull(loadContext); //Make sure the file exists if (!FileOperations.FileExists(assemblyName)) @@ -218,8 +218,8 @@ namespace VNLib.Utils.Resources BindingFlags flags = BindingFlags.Public ) where TDelegate : Delegate { - _ = obj ?? throw new ArgumentNullException(nameof(obj)); - return TryGetMethodInternal<TDelegate>(obj.GetType(), methodName, obj, flags | BindingFlags.Instance); + ArgumentNullException.ThrowIfNull(obj); + return TryGetMethodInternal<TDelegate>(obj.GetType(), methodName, obj, flags | BindingFlags.Instance); } /// <summary> @@ -271,7 +271,7 @@ namespace VNLib.Utils.Resources private static TDelegate? TryGetMethodInternal<TDelegate>(Type type, string methodName, object? target, BindingFlags flags) where TDelegate : Delegate { - _ = type ?? throw new ArgumentNullException(nameof(type)); + ArgumentNullException.ThrowIfNull(type); //Get delegate argument types incase of a method overload Type[] delegateArgs = typeof(TDelegate).GetMethod("Invoke")! |