chore: Replace `string.IsNullOrEmpty` method to IsBlank/IsNotBlank extension methods
This PR replace code that using string.IsNullOrEmpty method to use IsBlank/IsNotBlank extension methods.
Background
It's required to simplify code when enabled nullable features.
When targeting netstandard2.0 tfm.
Nullable annotations are not set on string.IsNullOrEmpty
So following code needs extra ! annotation when targeting netstandard2.0.
string? value = null;
if (!string.IsNullOrEmpty(value))
{
var length = value.Length!; // `!` is required
}
It can't change existing API's behaviors.
So replace to existing extension methods (IsBlank/IsNotBlank)
Note: These extension methods using IsNullOrWhiteSpace instead of IsNullOrEmpty.
What's changed in this PR
-
StringAndTextExtensions.cs/CommonExtensions.csAddNotNullWhenattributes to existing IsBlank/IsNotBlank/IsNullOrEmpty extension methods. -
Other files Replace code that using
string.IsNullOrEmptyto useIsBlank/IsNotBlank