Alex319
Alex319

Reputation: 3918

Where do you put the function documentation so that it shows up on intellisense?

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?

Upvotes: 33

Views: 24014

Answers (4)

Gustavo Ayala
Gustavo Ayala

Reputation: 136

To auto-generate the three-slash comment section on top of an existing method, just place the cursor on an empty line, right above the method definition and type three forward slashes ("///"). Visual Studio will auto-generate a three-slash comment that corresponds to your method. It will have placeholders for the summary, each parameter (if any) and the return value (if any). You just have to fill-in the blanks.

I would recommend you don't try to write these description blocks by hand and not to copy from one method to another. Third-party tools are also not necessary to generate them (at least in Visual Studio 2010).

Upvotes: 10

smnbss
smnbss

Reputation: 1041

"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

Upvotes: 5

Richard
Richard

Reputation: 109100

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.

Upvotes: 2

Brandon
Brandon

Reputation: 70012

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.

Upvotes: 54

Related Questions