Added nullable helper for IfNullOrWhiteSpace (#12979)
* Added nullable helper for IfNullOrWhiteSpace * Remove for str as that one could be an empty string
This commit is contained in:
@@ -419,7 +419,8 @@ public static class StringExtensions
|
||||
/// returns <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool IsNullOrWhiteSpace(this string? value) => string.IsNullOrWhiteSpace(value);
|
||||
|
||||
|
||||
[return: NotNullIfNotNull("defaultValue")]
|
||||
public static string? IfNullOrWhiteSpace(this string? str, string? defaultValue) =>
|
||||
str.IsNullOrWhiteSpace() ? defaultValue : str;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user