Code documentation refers to documenting source code, e.g., using comments.

Keeping documentation within source code comments is one way to simplify the documentation process, as well as increase the chances that the documentation will be kept up to date with changes in the code.

Automatic Documentation Generation

Programming tools sometimes store documentation and metadata in comments, e.g., insert positions for automatic header file inclusion, commands to set the file’s syntax highlighting mode, or a revision number. These control comments are also called “annotations”.

C#, F# and Visual Basic .NET implement a similar feature called “XML Comments” which are read by IntelliSense from the compiled .NET assembly.

Docs from XML Comments

Tools that accept XML documentation input:

  • DocFXDocFX is static site generator for API documentation for .NET, which currently supports C#, Visual Basic, and F#.
  • Sandcastle: The Sandcastle tools create help files for managed class libraries containing both conceptual and API reference pages. The Sandcastle tools are command-line based and have no GUI front-end, project management features, or automated build process. A Visual Studio integration package is also available for it so that help projects can be created and managed entirely from within Visual Studio.
  • DoxygenDoxygen is static site generator that build docs from a set of documented source files. There’s also support for generating output in RTF (MS Word), PostScript, hyperlinked PDF, compressed HTML, DocBook, and Unix manual pages. You can configure Doxygen to extract the code structure from undocumented source files.

Resources for good XML Documentation