Reputation: 42957
I am pretty new in C# (I came from Java)
In Java I often comment my methods using javadoc to document the paramether type and the returned value
Something like
/* @param an int
@param a Rectangle object
@return void
*/
public void myMethod(int i, Rectangle rec){
.............
.............
}
What is the convention to document these things in C#?
Upvotes: 0
Views: 486
Reputation: 322
Just insert three /// before a method, class, field etc. and write what you want and you can even add examples, exceptions and so on. An example:
/// <summary>
/// A function summary here.
/// </summary>
/// <param name="inParam">An in parameter</param>
Upvotes: 0
Reputation: 235
By default visual studio have triple back slash for commenting.When you put that above a function it will shows
/// <summary>
///
/// </summary>
where you can write your comments.
If you want something advanced please get the Ghostdoc from visualstudiogallery.Its a free tool.
Upvotes: 2
Reputation: 1564
You can use the "< summary >" tag.
Example from MSDN:
/// <summary>DoWork is a method in the TestClass class.
/// <para>Here's how you could make a second paragraph in a description. <see cref="System.Console.WriteLine(System.String)"/> for information about output statements.</para>
/// <seealso cref="TestClass.Main"/>
/// </summary>
http://msdn.microsoft.com/en-us/library/2d6dt3kf.aspx
Upvotes: 1
Reputation: 29668
Yes, look at XML Documentation.
There's a nice page on MSDN all about it - http://msdn.microsoft.com/en-us/library/z04awywx.aspx
Upvotes: 1