From fe5e072365063167e92baca2ff5d5f984ae4f6a0 Mon Sep 17 00:00:00 2001 From: Artyom Tonoyan Date: Mon, 21 Oct 2024 10:33:35 +0400 Subject: [PATCH] refactor: Update ThrowIfNull method --- .../MultiTarget/Guard.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/OpenFeature.DependencyInjection/MultiTarget/Guard.cs b/src/OpenFeature.DependencyInjection/MultiTarget/Guard.cs index e086fc23..8d2726b9 100644 --- a/src/OpenFeature.DependencyInjection/MultiTarget/Guard.cs +++ b/src/OpenFeature.DependencyInjection/MultiTarget/Guard.cs @@ -6,15 +6,9 @@ namespace OpenFeature; [DebuggerStepThrough] internal static class Guard { - public static T ThrowIfNull(T? value, [CallerArgumentExpression("value")] string name = null!) + public static void ThrowIfNull(object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) { -#if NET8_0_OR_GREATER - ArgumentNullException.ThrowIfNull(value, name); -#else - if (value is null) - throw new ArgumentNullException(name); -#endif - - return value; + if (argument is null) + throw new ArgumentNullException(paramName); } }