December 2007
Intermediate to advanced
896 pages
19h 57m
English
You need a quick and easy way to check if a string is either null or of zero length.
Use the static IsNullOrEmpty method of the String class:
bool stringTestResult = String.IsNullOrEmpty(testString);
The IsNullOrEmpty method is a very convenient method in that it allows you to test a string for null or zero length with a single method call. This method returns true if the string passed in to it is equal to one of the following:
Null
String.Empty
Otherwise, this method returns false.
The "String.IsNullOrEmpty Method" topic in the MSDN documentation.
Read now
Unlock full access