C# documentation comments use XML elements to define the structure of the output documentation. It helps to write the information about code and makes it more readable and understandable.
<para> tag
The <para> tag can be used inside a tag, such as <summary>, <remarks>, or <returns>.
It allows you to add structure to the text.
Here the <para> is used to add another line (paragraph) in the summary section.
/// <summary>
/// This property will keep the type of project.
/// <para>
/// The Type of project defined in the document.
/// </para>
/// </summary>
public string ProjectType { get; set; }
It will display this information on mouse hover like this:
cref attribute
The cref attribute in an XML documentation tag means "code reference." It specifies that the inner text of the tag is a code element, such as a type, method, or property.
Here the cref attribute is referencing another class which contains constant string values.
/// <summary>
/// <para>
/// Use <see cref="MyNamespace.ProjectStatus"/> class.
/// </para>
/// </summary>
public string Status { get; set; }
On mouse hover it will display like this:
Note that the ProjectStatus will appear as link, and will take you to the definition of class when clicked.


No comments:
Post a Comment