Thursday, April 3, 2008

How to Automatically Generate XML Comments in C# using Visual Studio .NET 2005

(Since I don't have a desktop software development blog right now I figured I'd better just put this here, since it could apply to C# programming with ASP.NET...)

To automatically generate XML comments in C# using VS.NET 2005, all you have to do is type a triple-whack ("///") in your code before a method definition and the IDE will build out the XML for you.

I accidentally stumbled on this on the same day I was trying to find out how to do it, which doesn't happen too often. I actually found it while nosing around in the VS.NET preferences:

Tools --> Options --> Text Editor --> C# --> Advanced

...which has an "XML Documentation Comments" section and a "Generate XML documentation comments for ///" checkbox.

You really need your miner's helmet for that one! Whew!

1 comment: