Public musings, often on software development RSS 2.0
# Wednesday, October 19, 2005

The release of Visual Studio Team System is going to impact developers more then they imagine.  One of the tools which has been becoming more and more popular with me as I use it is the Static Code Analysis tool.  I've never been a big fan of source code scanners but as they value of the feedback they provide increases so does my preference toward using them.  The Static Code Analysis module in Visual Studio 2005 fits this model.

I don't want to create a long post, I just want to highlight one particular check which ships with the RC1 version of Static Code Analysis.  This check is in the Performance category.   CA1820 looks at places in your code where you are doing string comparisons, in particular where you are comparing to Null/Nothing or the empty string ("").  When it sees these it triggers a warning to let you know about a new feature of the Framework's string class.

With .NET 2.0 the String class has been enhanced with a static method that checks for Null Or Empty, it's called IsNullOrEmpty.  The CA1820 check lets you know where in your code you should be referencing this new static method.  To use this method just type the following:

VB: If String.IsNullOrEmpty(stringText) Then

C#: if (String.IsNullOrEmpty(stringText))

So in this case the Static Code Analisys is actually identifing places in your code where you can leverage new language features to improve performance.  Of course there are already almost two dozen such performance checks and I'm sure more will be created over time.

Wednesday, October 19, 2005 3:05:15 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
Team System | Technology
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Bill Sheldon
Sign In
All Content © 2010, Bill Sheldon