Tuesday, 11 February 2014

XML Documentation in C#

In C#, we use XML Comments for creating documentation for Classes and its member. XML Documentation helps other programmer or developer to use your code i.e. Classes, Functions and its member easily by providing some useful information. XML Documentation starts with three slashes before the class or function going to be documented.

Adding XML Documentation to a class:

Typing three slashes (///) before a class or function will create documentation automatically in Visual Studio. Documentation contain one or more than one documentation elements. Each element starts with start tag (e.g. <summary>) and ends with end tag (e.g. </summary>).
Element
Description
<summary>
Provide Description for Class, member etc.
<param name=”i”>
Describe a parameter of a method
<returns>
Describe return type of a method
<value>
Describe value of a property
For Example:-

In above example, when we type three slashes before result method than it will automatically create three documentation elements that are Summary (used for description of class), param tag for each parameter and return tag for method’s return type.

When I type or use Add class than, IntelliSense in Visual Studio show Screen tip that we have added in xml documentation element (<summary tag>) earlier.
Preview:

Protected by Copyscape Web Plagiarism Scanner



0 comments:

Post a Comment

Subscribe Now

Popular Posts

Contact us

Name

Email *

Message *

Subscribe us on YouTube

Like us on Facebook

Follow us on Google+