System.String.IsNullOrEmpty()



I don't have Team System, so I don't automatically use static code analysis / fxcop as much as I should.

I was recently going through some static code analysis, and one recommendation was to use String.IsNullOrEmpty(), which was added in .NET 2.0,rather than constructs like

    if(s == string.Empty || s == null){

I'd been doing checks like above out of habit since .NET 1.1. Obviously, IsNullOrEmpty is much nicer!

Categories

| Comments (0)TrackBacks (0)

0 TrackBacks

Listed below are links to blogs that reference this entry: System.String.IsNullOrEmpty().

TrackBack URL for this entry: http://www.rootsilver.com/mt-tb.cgi/41

Leave a comment