Chapter 12. Documentation with XML Comments

WHAT'S IN THIS CHAPTER?

  • Adding inline documentation to your code using XML comments

  • Using the GhostDoc Visual Studio Add-In to automatically generate XML comments

  • Producing stand-alone documentation from XML comments with Sandcastle

  • Using Task List comments to keep track of pending coding tasks and other things to do

Documentation is a critical, and often overlooked, feature of the development process. Without documentation, other programmers, code reviewers, and project managers have a more difficult time analyzing the purpose and implementation of code. You can even have problems with your own code once it becomes complex, and having good internal documentation can aid in the development process.

XML comments are a way of providing that internal documentation for your code without having to go through the process of manually creating and maintaining a separate document. Instead, as you write your code, you include metadata at the top of every definition to explain the intent of your code. Once the information has been included in your code, it can be consumed by Visual Studio to provide Object Browser and IntelliSense information.

GhostDoc is a free third-party add-in for Visual Studio that can automatically insert an XML comment block for a class or member.

Sandcastle is a set of tools that act as a documentation compiler. These tools can be used to easily create standalone documentation in Microsoft compiled HTML help or Microsoft Help 2 format ...

Get Professional Visual Studio® 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.