Geeks With Blogs
.NET Development and Design Gerardo Calderon

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.

Posted on Friday, August 26, 2011 7:55 AM | Back to top


Comments on this post: String.IsNullOrWhiteSpace

# re: String.IsNullWithWhiteSpace
Requesting Gravatar...
is it IsNullOrWhiteSpace or IsNullWithWhiteSpace ? .. I sure can check it myself
Left by misotor on Aug 26, 2011 9:49 AM

# re: String.IsNullOrWhiteSpace
Requesting Gravatar...
Sorry about the confusion. It's String.IsNullOrWhiteSpace.
Left by Gerardo on Aug 26, 2011 4:18 PM

Your comment:
 (will show your gravatar)


Copyright © gerardosblog | Powered by: GeeksWithBlogs.net