9.2. XML Comments
XML comments are specialized comments that you include in your code listings. When the project goes through the build process, Visual Studio can optionally include a step to generate an XML file based on these comments to provide information about user-defined types such as classes and individual members of a class (user-defined or not), including events, functions, and properties.
XML comments can contain any combination of XML and HTML tags. Visual Studio will perform special processing on a particular set of predefined tags, as you'll see throughout the bulk of this chapter. Any other tags will be included in the generated documentation file as is.
9.2.1. Adding XML Comments
XML comments are added immediately before the property, method, or class definition they are associated with. Visual Studio will automatically add an XML comment block when you type the shortcut code /// in C# before a member or class declaration. In some cases the XML comments will already be present in code generated by the supplied project templates, as you can see in Figure 9-1.
Figure 9.1. Figure 9-1
The automatic insertion of the summary section can be turned off on the Advanced page for C# in the Text Editor group of options.
Adding an XML comment block to Visual Basic is achieved by using the ''' shortcut code. In this way it replicates the way C# documentation is generated. ...
Get Professional Visual Studio® 2008 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.