Skip to Main Content
Professional Visual Studio® 2008
book

Professional Visual Studio® 2008

by Nick Randolph, David Gardner
July 2008
Intermediate to advanced content levelIntermediate to advanced
1026 pages
27h 59m
English
Wrox
Content preview from Professional Visual Studio® 2008

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. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Visual Studio® 2010

Professional Visual Studio® 2010

Nick Randolph, David Gardner, Michael Minutillo, Chris Anderson

Publisher Resources

ISBN: 9780470229880Purchase book