feat: fix code analysis for IsNullOrEmpty, IsNullOrWhitespace extensions

This commit is contained in:
goaaats 2022-06-17 18:46:54 +02:00
parent b083ea65c0
commit 399bc7b4de
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;
namespace Dalamud.Utility namespace Dalamud.Utility
{ {
/// <summary> /// <summary>
@ -18,13 +20,13 @@ namespace Dalamud.Utility
/// </summary> /// </summary>
/// <param name="value">The string to test.</param> /// <param name="value">The string to test.</param>
/// <returns>true if the value parameter is null or an empty string (""); otherwise, false.</returns> /// <returns>true if the value parameter is null or an empty string (""); otherwise, false.</returns>
public static bool IsNullOrEmpty(this string? value) => string.IsNullOrEmpty(value); public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value) => string.IsNullOrEmpty(value);
/// <summary> /// <summary>
/// Indicates whether a specified string is null, empty, or consists only of white-space characters. /// Indicates whether a specified string is null, empty, or consists only of white-space characters.
/// </summary> /// </summary>
/// <param name="value">The string to test.</param> /// <param name="value">The string to test.</param>
/// <returns>true if the value parameter is null or an empty string (""), or if value consists exclusively of white-space characters.</returns> /// <returns>true if the value parameter is null or an empty string (""), or if value consists exclusively of white-space characters.</returns>
public static bool IsNullOrWhitespace(this string? value) => string.IsNullOrWhiteSpace(value); public static bool IsNullOrWhitespace([NotNullWhen(false)] this string? value) => string.IsNullOrWhiteSpace(value);
} }
} }