From b2cf22efdfc2d1e43a27466edbe16fcadf8d39ee Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 6 Mar 2022 17:27:31 +0000 Subject: [PATCH] (#15) Improve xmldoc for string.AsNullIfEmpty/WhiteSpace --- X10D/src/StringExtensions/StringExtensions.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/X10D/src/StringExtensions/StringExtensions.cs b/X10D/src/StringExtensions/StringExtensions.cs index 7209ae0..c35f2ce 100644 --- a/X10D/src/StringExtensions/StringExtensions.cs +++ b/X10D/src/StringExtensions/StringExtensions.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using System.Text; namespace X10D; @@ -8,27 +9,29 @@ namespace X10D; public static class StringExtensions { /// - /// Returns the current string, or if the current string is null or empty. + /// Normalizes a string which may be either or empty to . /// - /// The value to sanitize. + /// The value to normalize. /// - /// if is or equal to - /// , or otherwise. + /// if is or empty; otherwise, + /// . /// + [return: NotNullIfNotNull("value")] public static string? AsNullIfEmpty(this string? value) { return string.IsNullOrEmpty(value) ? null : value; } /// - /// Returns the current string, or if the current string is null, empty, or consists of only - /// whitespace. + /// Normalizes a string which may be either , empty, or consisting of only whitespace, to + /// . /// - /// The value to sanitize. + /// The value to normalize. /// - /// if is or equal to - /// or is composed of only whitespace characters, or otherwise. + /// if is , empty, or consists of only + /// whitespace; otherwise, . /// + [return: NotNullIfNotNull("value")] public static string? AsNullIfWhiteSpace(this string? value) { return string.IsNullOrWhiteSpace(value) ? null : value;