I have just started doing some serious development in .NET 2.0.   As part of a tidy up exercise across my code base I decided to run FXCop over it to see the types of errors that it would produce.  One error that I noticed introduced me to a new feature in .NET 2.0.  String.IsNullOrEmpty.   In .NET 1.1 when checking to see if a string was empty you always had to check against null and string.empty.  For example:

I used to do if (Config.RegistrationUserName != null && Config.RegistrationUserName != string.Empty).  In .Net 2.0 I can now do if (String.IsNullOrEmpty(Config.RegistrationUserName == false)

Nothing like saving you time and typing

Advertisements