65.9K
CodeProject is changing. Read more.
Home

.NET 4: string.IsNullOrWhitespace()

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.33/5 (2 votes)

Aug 12, 2010

CPOL
viewsIcon

16150

public static class StringExtensions { public static bool IsNullOrWhitespace(this string s) { if (null == s) return true; return string.IsNullOrEmpty(s.Trim()); } }

public static class StringExtensions
    {
        public static bool IsNullOrWhitespace(this string s)
        {
            if (null == s) return true;
            return string.IsNullOrEmpty(s.Trim());
        }
    }