CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

IsNullOrWhiteSpace with some LINQ love

400 Views
Copy Code Show/Hide Line Numbers
/// <summary>
/// Determine if the specified string is blank, where blank is defined 
/// as null, empty or containing only whitespace characters.
/// </summary>
/// <param name="value">string to be evaluated</param>
/// <returns>
/// true if the value is null, empty or contains only 
/// whitespace characters; otherwise false
/// </returns>
static bool IsNullOrWhiteSpace(string value)
{
    if (string.IsNullOrEmpty(value)) return true;
    return !value.Any(c => !char.IsWhiteSpace(c));
}
by Al Gonzalez
  March 15, 2010 @ 11:05am
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate