How do I add XML documentation for Methods in c# that comes in .N开发者_运维问答ET functions.
Example
Guid.NewGuid();
when user press . key he gets a help about the function NewGuid what it does.
I have a class GetDocsInfo which have functions like getDocTag and I need a similar functionality, is there any meta data kind of things I need to add just like attributes
What you are talking about is simply the intellisense that is shown. This is extracted from the comment metadata for the function or property, i.e.:
/// <summary>
/// My details here....
/// </summary>
public void MyFunction()
{
... etc ...
}
If you put the editing cursor on the line above the function you want to document, then type three consecutive forward slashes, Visual Studio will then auto populate the comment section for you, all you have to do is insert the details.
Alternatively, you could use a Visual Studio plugin called GhostDoc, which gives you an option in your context menu to automatically document the function - it does a reasonable job of determining what the documentation should be based on the parameters and the name of the function.
You need to add XML documentation for class members. While you type code in Visual studio press / key three times in the line just about your member definition and a skeleton will be generated which you can edit.
/// <summary>
/// What your function does.
/// </summary>
/// <param name="paramterName">Description of parameter</param>
public void Method Name(string paramterName)
{
}
I am not sure if I understand it correctly because its a very common thing to do in C# but if you are using C#, the triple slashes can be used to generate documentation for a function:
/// <summary>
/// Adds two numbers
/// </summary>
/// <param name="x">First number</param>
/// <param name="y">Second number</param>
/// <returns>The sum of specified numbers</returns>
private int Sum(int x, int y)
{
return x + y;
}
by writing '///' above ur function or class
https://stackoverflow.com/questions/641364/c-documentation-generator
精彩评论