Monday, September 6, 2010

Check if string is null or empty.

I have seen so many lines of code where people write checks for a string being null or blank. Also, sometimes there is no check for string being empty.
For example:

There is a better way of doing this, there is very neat static function in the String class which does this check for you String.IsNullOrEmpty(string value).

No comments:

Post a Comment