String.IsNullOrEmpty()
One of my favorite additions to the .NET framework in 2.0 is the wonderful String.IsNullOrEmpty method. In the old 1.1 days we'd often times end up with code that looks something like this:
public string DoSomeSuperCoolStringThing(string myString) {
if(myString != null && myString.Length > 0) {
// the good stuff
}
}
With .NET 2.0 this code can become:
public string DoSomeSuperCoolStringThing(string myString) {
if(!String.IsNullOrEmpty(myString)) {
// the good stuff
}
}
Sweet eh?