Public APIs (including methods, constructors, classes, structs and interfaces) should be documented to help make the API easier to understand and maintain. For the purpose of code maintainability, it is also advisable to document non-public APIs.

Add appropriate documentation. The documentation comment should describe what the method or constructor does rather than how it does it, to allow for any potential implementation change that is invisible to users of an API. It should include the following:

Documentation for users of an API should be written using the standard documentation format. This can be accessed conveniently by users of an API from within standard IDEs, and can be transformed automatically into HTML format.

The following example shows a fully documented class, illustrating the use of <summary>, <param>, <returns>, and <exception> tags.

  • MSDN, C# Programming Guide: XML Documentation Comments, How to: Use the XML Documentation Features, Recommended Tags for Documentation Comments.