Code Analysis

Running Code Analysis (available through the project’s context menu) usually yields quite a few warnings related to methods. Figure 10.26 shows the result of running the analysis (with all rules enabled in the project’s settings) for a simple program. All the warnings should be understood by now, and fixes should be obvious.


FIGURE 10.26 Some Code Analysis warnings related to methods.

You can suppress warnings if you have some good reason for it. Using the rule sets feature available through the project’s configuration settings, each project can decide what level of strictness to apply with regard to various rules. For example, ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.