To display XML comments with a newline

Page creation date :

In Visual Studio, you can write XML document comments on C# and VB.NET properties and methods. You can write this to display a description of a property or method, for example, when you write a property or method in code, or when you hover over a mouse cursor, when you use a tool such as Sandcastle.

However, i usually write in about one line because the readability decreases when I write too much, but I think that there is a case that I want to display it in a plural ity in some cases.

If you break in the comments normally, but I think you expect to be displayed in line breaks when the description is displayed, it will be displayed in the following feeling and actually try.

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

The result of the description

The description does not break a line, and it becomes the layout as if there was a space. Xml depends on how white space and line breaks are handled, and visual studio doesn't consider regular line breaks to be line breaks.

So if you want to break the description, what to do is use the "para" tag. Para stands for paragraph. Enclose it with a para tag in the units you want to break as follows:

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

The description is broken as shown in the figure. If you use the document generation tool, it will also be broken as a paragraph and displayed.