From 399bc7b4deaf75ba0b6d409450db87e1d25be906 Mon Sep 17 00:00:00 2001 From: goaaats Date: Fri, 17 Jun 2022 18:46:54 +0200 Subject: [PATCH] feat: fix code analysis for IsNullOrEmpty, IsNullOrWhitespace extensions --- Dalamud/Utility/StringExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dalamud/Utility/StringExtensions.cs b/Dalamud/Utility/StringExtensions.cs index 3aa9f70bd..1cd72c674 100644 --- a/Dalamud/Utility/StringExtensions.cs +++ b/Dalamud/Utility/StringExtensions.cs @@ -1,3 +1,5 @@ +using System.Diagnostics.CodeAnalysis; + namespace Dalamud.Utility { /// @@ -18,13 +20,13 @@ namespace Dalamud.Utility /// /// The string to test. /// true if the value parameter is null or an empty string (""); otherwise, false. - public static bool IsNullOrEmpty(this string? value) => string.IsNullOrEmpty(value); + public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value) => string.IsNullOrEmpty(value); /// /// Indicates whether a specified string is null, empty, or consists only of white-space characters. /// /// The string to test. /// true if the value parameter is null or an empty string (""), or if value consists exclusively of white-space characters. - public static bool IsNullOrWhitespace(this string? value) => string.IsNullOrWhiteSpace(value); + public static bool IsNullOrWhitespace([NotNullWhen(false)] this string? value) => string.IsNullOrWhiteSpace(value); } }