Added StringHelper.IsNullOrWhiteSpace to account for missing function prior to .NET 4. (#86)

pull/90/head
David Hall 2019-12-30 10:25:45 -07:00
parent b875577809
commit 08273f800c
1 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using Vanara.InteropServices;
@ -210,6 +211,14 @@ namespace Vanara.Extensions
/// </returns>
public static string GetString(IntPtr ptr, int length, CharSet charSet = CharSet.Auto) => GetString(ptr, charSet, length * GetCharSize(charSet));
/// <summary>Indicates whether a specified string is <see langword="null"/>, empty, or consists only of white-space characters.</summary>
/// <param name="value">The string to test.</param>
/// <returns>
/// <see langword="true"/> if the <paramref name="value"/> parameter is <see langword="null"/> or <see cref="string.Empty"/>, or if
/// value consists exclusively of white-space characters.
/// </returns>
public static bool IsNullOrWhiteSpace(string value) => value is null || value.All(c => char.IsWhiteSpace(c));
/// <summary>Refreshes the memory block from the unmanaged COM task allocator and copies the contents of a new managed String.</summary>
/// <param name="ptr">The address of the first character.</param>
/// <param name="charLen">Receives the new character length of the allocated memory block.</param>