Skip to content

Commit

Permalink
refactor: Update ThrowIfNull method
Browse files Browse the repository at this point in the history
  • Loading branch information
arttonoyan committed Oct 21, 2024
1 parent 3089129 commit fe5e072
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/OpenFeature.DependencyInjection/MultiTarget/Guard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ namespace OpenFeature;
[DebuggerStepThrough]
internal static class Guard
{
public static T ThrowIfNull<T>(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);
}
}

0 comments on commit fe5e072

Please sign in to comment.