String.IsNullOrEmpty (.NET 2.0)

How many times have you written the following string validation code:

if (_name == null || _name.Length == 0)
{
    // ...
}

With .NET 2.0, you can use the static ("Shared" in Visual Basic.NET) utility method String.IsNullOrEmpty to do the same thing:

if (string.IsNullOrEmpty(_name))
{
    // ...
}

No Comments