In C# 4.0 we can check whether
1. String is null.
2. String is empty.
3. String contains nothing but whitespace.
All these can be achieved by using string.IsNullOrWhiteSpace
static void Main(string[] args)
{
string value1 = " ";
Console.WriteLine(string.IsNullOrWhiteSpace(value1));
string value2 = "";
Console.WriteLine(string.IsNullOrWhiteSpace(value2));
string value3 = null;
Console.WriteLine(string.IsNullOrWhiteSpace(value3));
Console.Read();
}
Result
True
True
True