This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

VS 2003+

Enabling Automatic Documentation Comments

XML documentation comments allow code to be decorated with information about its usage. Visual Studio can assist in generating these comments by expanding a special comment symbol into a series of comment placeholders, which can be completed manually.

XML Documentation Comments

XML documentation comments can be added to C# code to provide information about classes, methods, properties and other items. This information is made available via the Visual Studio Intellisense feature. The documentation can also be compiled into separate XML files, which can be converted into distributable HTML help files using tools such as Sandcastle.

By default, Visual Studio detects when you type the special documentation comment symbol, which is three forward slashes (///). Depending upon the position at which you insert the symbol, it is expanded into a series of comments, each with XML placeholders for important information. For example, when decorating a method, placeholders are created for a summary of the method, information relating to each parameter and a section to describe the return value.

Some developers prefer that the automatic expansion of the documentation comment symbol be disabled. If you wish to disable the feature, or if you are using an installation of Visual Studio where it has been disabled and you wish to re-enable it, you can configure the setting in the Options dialog box. To do so, select "Options" from the "Tools" menu. Expand the "Text Editor" and "C#" branches of the tree structure at the left side of the dialog and choose the "Advanced" branch. You can then use the "Generate XML documentation comments for ///" checkbox to enable and disable the feature.

If you are using Visual Studio 2003, the setting is in a different place. Again, choose "Options" from the "Tools" menu. Expand the "Text Editor" and "C#" branches of the treeview and select "Formatting". The checkbox that you need to use is named, "Smart comment editing".

Visual Studio XML Documentation Comments Options

22 February 2012