1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:25:41 +00:00

(#42) Use NRT for AddNullIf__

This commit is contained in:
Oliver Booth 2021-07-19 11:38:24 +01:00
parent 14b43adf82
commit 92d60a6db8
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -18,7 +18,7 @@ namespace X10D
/// <see langword="null" /> if <paramref name="value" /> is <see langword="null" /> or equal to /// <see langword="null" /> if <paramref name="value" /> is <see langword="null" /> or equal to
/// <see cref="string.Empty" />, or <paramref name="value" /> otherwise. /// <see cref="string.Empty" />, or <paramref name="value" /> otherwise.
/// </returns> /// </returns>
public static string? AsNullIfEmpty(this string value) public static string? AsNullIfEmpty(this string? value)
{ {
return string.IsNullOrEmpty(value) ? null : value; return string.IsNullOrEmpty(value) ? null : value;
} }
@ -32,7 +32,7 @@ namespace X10D
/// <see langword="null" /> if <paramref name="value" /> is <see langword="null" /> or equal to /// <see langword="null" /> if <paramref name="value" /> is <see langword="null" /> or equal to
/// <see cref="string.Empty" /> or is composed of only whitespace characters, or <paramref name="value" /> otherwise. /// <see cref="string.Empty" /> or is composed of only whitespace characters, or <paramref name="value" /> otherwise.
/// </returns> /// </returns>
public static string? AsNullIfWhiteSpace(this string value) public static string? AsNullIfWhiteSpace(this string? value)
{ {
return string.IsNullOrWhiteSpace(value) ? null : value; return string.IsNullOrWhiteSpace(value) ? null : value;
} }