Skip to content

Commit 148c7ba

Browse files
committed
use ArgumentException.ThrowIfNullOrWhiteSpace
1 parent 810c8d0 commit 148c7ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Polyfill/Guard_NotWhiteSpace.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public static void NotWhiteSpace(
2222
{
2323
return;
2424
}
25+
#if NET8_0_OR_GREATER
26+
ArgumentException.ThrowIfNullOrWhiteSpace(value, argumentName);
27+
return value;
28+
#else
2529

2630
if (value.Length == 0)
2731
{
@@ -37,6 +41,7 @@ public static void NotWhiteSpace(
3741
}
3842

3943
throw new ArgumentException("Argument cannot be whitespace.", argumentName);
44+
#endif
4045
}
4146
#if FeatureMemory
4247

0 commit comments

Comments
 (0)