using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace IsNullOrEmptyDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            string text = " ";
            Console.WriteLine(IsNullOrEmpty(text));
            Console.WriteLine(string.IsNullOrEmpty(text));
            Console.Read();
        }
        static bool IsNullOrEmpty(string text)
        {
            if (text == null)
                return true;
            return !Regex.IsMatch(text, @"\S");
        }
    }
}

更多推荐