To display XML comments on a new line

Page update date :
Page creation date :

In Visual Studio, you can write XML document comments on C# and VB.NET properties and methods. Once you write it, you will be able to view the description of the property or method when you write it in code, hover the mouse cursor, and use a tool such as "Sandcastle".

However, if you write too much, the readability will decrease, so usually you will write it in about one line, but in some cases you may want to display it on multiple lines.

If you break a line in a comment normally, you will expect it to be displayed with a line break when the description is displayed, but when you actually try it, it will be displayed as follows.

/// <summary>
/// これは
/// 普通に
/// 改行したもの
/// <summary>
public int Amount1 { get; set; }

Explanation display result

There are no line breaks in the description text, and the layout looks as if it contains spaces. XML has a varying effect on how whitespace and line breaks are handled, and Visual Studio doesn't consider normal line breaks to be text breaks.

So, if you want to break the description text on a line, how to do it is to use the "para" tag. "para" stands for "paragraph". Enclose the units you want to break lines like this in a para tag:

/// <summary>
/// <para>paraを</para>
/// <para>使って</para>
/// <para>改行したもの</para>
/// </summary>
public int Amount2 { get; set; }

The description is displayed with a line break as shown in the figure. If you use the document generation tool, it will also appear as a paragraph with line breaks.