Skip to Content
Programming C#
book

Programming C#

by Jesse Liberty
July 2001
Intermediate to advanced
688 pages
16h 14m
English
O'Reilly Media, Inc.
Content preview from Programming C#

XML Documentation Comments

C# supports a new Documentation Comment style, with three slash marks (///). You can see these comments sprinkled throughout Example 13-3. The Visual Studio.NET editor recognizes these comments and helps format them properly.

The C# compiler processes these comments into an XML file. You can create this file by using the /doc command-line switch. For example, you might compile the program in Example 13-3 with this command line:

csc filecopier.cs /r:System.Windows.Forms.dll /r:mscorlib.dll 
/r:system.dll /r:system.configuration.dll /r:system.data.dll 
/r:system.diagnostics.dll /r:system.drawing.dll /r:microsoft.win32.interop.dll 
/doc:XMLDoc.XML

You can accomplish this same operation in Visual Studio .NET by clicking a project icon in the Solution Explorer window, selecting View Property Pages on the Visual Studio menu, and then clicking the Configuration Properties folder. Within the Configuration Properties folder, click the Build property page and type in a name for the XML Documentation File property to specify a name for the XML file you want to produce.

Either approach produces the file XMLDoc.XML with your comments in XML format. An excerpt of the file that will be produced for the FileCopier application of the previous section is shown in Example 13-4.

Example 13-4. The XML output (excerpt) for file copy

<?xml version="1.0"?> <doc> <assembly> <name>FileCopier</name> </assembly> <members> <member name="T:FileCopier.Form1"> <summary> Form demonstrating ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Programming C#, Second Edition

Programming C#, Second Edition

Jesse Liberty
Programming C# 8.0

Programming C# 8.0

Ian Griffiths
Learn C# Programming

Learn C# Programming

Marius Bancila, Prakash Tripathi, Raffaele Rialdi, Ankit Sharma
Programming C# 12

Programming C# 12

Ian Griffiths

Publisher Resources

ISBN: 0596001177Catalog PageErrata