Skip to content

Commit

Permalink
use ArgumentException.ThrowIfNullOrWhiteSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Nov 13, 2024
1 parent 810c8d0 commit 148c7ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Polyfill/Guard_NotWhiteSpace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static void NotWhiteSpace(
{
return;
}
#if NET8_0_OR_GREATER
ArgumentException.ThrowIfNullOrWhiteSpace(value, argumentName);
return value;
#else

if (value.Length == 0)
{
Expand All @@ -37,6 +41,7 @@ public static void NotWhiteSpace(
}

throw new ArgumentException("Argument cannot be whitespace.", argumentName);
#endif
}
#if FeatureMemory

Expand Down

0 comments on commit 148c7ba

Please sign in to comment.