From 4f99763a0a8b78d5c3611ba3288a4bf77cbf1d6f Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 6 Mar 2022 17:32:53 +0000 Subject: [PATCH] Remove string.WithAlternative Yeah... so I already had this method which accepted a bool, forgot about that. But now it's separated into more meaningfully-named methods. So... https://www.youtube.com/watch?v=oJimiVFCjJ0 --- X10D/src/StringExtensions/StringExtensions.cs | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/X10D/src/StringExtensions/StringExtensions.cs b/X10D/src/StringExtensions/StringExtensions.cs index 9f08c43..34eb091 100644 --- a/X10D/src/StringExtensions/StringExtensions.cs +++ b/X10D/src/StringExtensions/StringExtensions.cs @@ -477,28 +477,6 @@ public static class StringExtensions : default; } - /// - /// Returns the current string, or an alternative value if the current string is null or empty, or optionally if the - /// current string consists of only whitespace. - /// - /// The value to check. - /// The alternative value if does not meet the criteria. - /// - /// Optional. If set to , will be returned also if - /// only consists of whitespace. - /// - /// Returns or . - /// is . - public static string WithAlternative(this string? value, string alternative, bool includeWhiteSpace = false) - { - if (alternative is null) - { - throw new ArgumentNullException(nameof(alternative)); - } - - return (includeWhiteSpace ? value?.AsNullIfWhiteSpace() : value?.AsNullIfEmpty()) ?? alternative; - } - /// /// Normalizes a string which may be either or empty to a specified alternative. ///