views:

131

answers:

4

I'm writing a library and I want to put documentation in my functions so that it will show up in intellisense, kind of like how the intellisense for the built in functions shows descriptions for each of the parameters and for the function itself. How do you put the documentation in? Is it through comments in the function or is it in some separate file?

+12  A: 

Use XML comments above the function signature.

    /// <summary>
    /// Summary
    /// </summary>
    /// <param name="param1">Some Parameter.</param>
    /// <returns>What this method returns.</returns>

The GhostDoc plugin can help generate these for you.

Brandon
I'd also recommend using StyleCop for Visual Studio to enforce consistent documentation/style through a project.
Will Eddins
@Guard, good suggestion. Inconsistent documentation is sometimes quite the pain.
Brandon
+1  A: 

Yes, use the three-slash comments.

Dmitry Ornatsky
A: 

As well as the XML comments you need to enable building the documentation (in the project settings) and keep the generated XML file with the assembly.

Richard
+2  A: 

"XML Documentation Comments (C# Programming Guide) In Visual C# you can create documentation for your code by including XML tags in special comment fields in the source code directly before the code block they refer to."

http://msdn.microsoft.com/en-us/library/b2s063f7.aspx

you can then use Sandcastle to generate chm files too if you want

http://www.hanselman.com/blog/SandcastleMicrosoftCTPOfAHelpCHMFileGeneratorOnTheTailsOfTheDeathOfNDoc.aspx

smnbss