by Dominic Zukiewicz
11. July 2007 09:53
The XML comments in C# are very useful in commenting code for use with the Intellisense. The generated XML file can be used to assist other developers with the parameters, explanations of methods and use of classes. Also, with automated tools like NDoc and SandCastle, you are able to generate documentation for your source code. If you do not comment it in the right places, you can get some ugly red messages saying "<COMMENT MISSING>".
The best way to ensure that all of your public methods, properties and classes are commented is to make Visual Studio generate the XML documentation for your class.
This is achieved by clicking on the Project, right click, Properties and in the Build tab selecting "Generated XML Documentation".
This will then produce a list of warnings telling you where the XML is missing!
All projects of any medium-large scale should have all public properties, methods and classes documented. Any code that isn't is doomed to fail.
For more information on documentation techniques, good and bad, I would strongly recommend Steve McConnell's Code Complete Version 2 (listed in my references section).
9d786f66-1027-44ef-b994-3f296b881e4c|0|.0
Tags:
Xml