I’ve started using the XML commenting feature in VS 2008. It’s great!!!
I knew that it was there, but I never realized that there was Intellisense support for writing the comments. I figured I have to remember a bunch of XML tags and write it all by hand. Not so. It’ super easy to write the comments using the XML comments blocks!
To get started just try it. All you have to do is type three apostrophes and VS will inject an XML comment block with a summary, remarks and sections for each of the parameters on the method. Then you just type your comments. If you hit enter, it will automatically put in another line with three apostrophes for you.
There are two great benefits to using these comments:
You get immediate Intellisense support within your project as you write it. Projects that reference your DLL will also get Intellisense if the .XML file is available when they add a reference.
Figure 1: XML Comments block and the resulting Intellisense support.
You can run tools like Sandcastle against the code to create very nice help documentation. This will be very helpful for some of the common libraries that we have.
(Sandcastle is a tool that will inspect your code and output documentation that looks similar to the class library documentation available from MSDN.)
There are other articles out there that go into this stuff in detail, but I wanted to spread the word that it is super easy and will provide immediate benefit to you right away!