I recently started working with Visual Studio 2010 and .NET 4.0 and I came across one of the new language features, String.IsNullWithWhiteSpace. Basically, it's an enhanced version of the commonly used String.IsNullOrEmpty. This new enhanced version goes a step forward and checks for whitespaces such as tabs.
String myString = “ “;
//returns false
Bool result = String.IsNullOrEmpty(myString);
//returns true
Bool result = String.IsNullOrWhiteSpace(myString);
A simple but convenient feature.
Print | posted on Friday, August 26, 2011 7:55 AM