Skip to content

Commit 7adb11b

Browse files
committed
use ArgumentException.ThrowIfNullOrEmpty
1 parent 9613777 commit 7adb11b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Polyfill/Guard_NotEmpty.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ static partial class Guard
1919
{
2020
public static void NotEmpty(string? value, [CallerArgumentExpression("value")] string argumentName = "")
2121
{
22+
#if NET7_0_OR_GREATER
23+
ArgumentException.ThrowIfNullOrEmpty(value, argumentName);
24+
#else
2225
if (value is null)
2326
{
2427
return;
@@ -28,6 +31,7 @@ public static void NotEmpty(string? value, [CallerArgumentExpression("value")] s
2831
{
2932
throw new ArgumentException("Argument cannot be empty.", argumentName);
3033
}
34+
#endif
3135
}
3236

3337
#if FeatureMemory

0 commit comments

Comments
 (0)