28

XML Documentation

Up to this point in this book, you've seen the entire C# language and a whole bunch of things you can do with it, including both Web and Windows programming. Along the way you've seen, and made extensive use of, the IntelliSense feature in Visual Studio. This helpful tool dramatically cuts down on the amount of typing you have to do, because it suggests keywords, type names, variable names, and parameters as you type. It also makes it easier to remember what methods and properties you have at your disposal and often tells you exactly how to use them.

However, the classes you have made have suffered slightly here. While the classes and member names are suggested for you, no handy hints pop up telling you how to do things. To achieve the kind of behavior that you see with the .NET Framework types, you need to use XML documentation. XML documentation enables you to include syntax, help, and examples for the classes you create at the source code level. This information may then be used to provide IntelliSense information for Visual Studio as discussed above, but there are other possibilities. You can use XML documentation as a starting point for full, MSDN-link documentation of your projects. Or you can style the XML documentation using XSLT to obtain instant HTML documentation with very little effort. You have seen in earlier chapters just how versatile XML is, and you can use all of its power in the development and production lifecycle of your applications.

Get Beginning Visual C#® 2005 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.