novicecoder.com

June 6, 2006

String testing made easy

Do you have lots of places in your code where you do:

if (stringval == null || stringval.Length == 0)
{
  handle string...
}

Well, .NET 2.0 adds a static method to the string class for IsNullOrEmpty. So now you can just test against string.IsNullOrEmpty(stringval) and save yourself a few keystrokes.

Filed under: C#, Strings — Kevin @ 1:42 am

Home
© 2006 NoviceCoder | All rights reserved.