Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NewLine in object summary

You want to use some thing like this

/// <summary> 
/// Your Main comment 
/// <para>This is line 1</para> 
/// <para>This is line 2</para> 
/// </summary> 
public bool TestLine { get; set; }

This may be an old thread but I was searching for an anwser while using Visual Studio 2019. I wanted paragraph and lines breaks. The following works well for me:

/// <summary>
/// <para>parameter name="guidType" options:</para>
/// <br>0 = SequentialAsString</br>
/// <br>1 = SequentialAsBinary</br>
/// <br>2 = SequentialAtEnd</br>
/// </summary>

Produces the following:

parameter name="guidType" options:

0 = SequentialAsString
1 = SequentialAsBinary
2 = SequentialAtEnd

Yes:

/// <summary> 
/// Main comment 
/// <para>Line 1</para> 
/// <para>Line 2</para> 
/// </summary> 
public bool TestLine { get; set; }

You can use <para /> to add a new line within summary:

/// <summary> 
/// Main comment<para />
/// Line 1<para />
/// Line 2<para />
/// </summary>
public bool TestLine { get; set; }

Looks like:

Main comment
Line 1
Line 2

Best regards!


You can legitimately add para tags, but this actually creates a new paragraph for each new line and the line spacing appears off.
I personally add 1 para around the paragraph and then br tags at the end of the lines I wanted a break on, which preserves decent line spacing:

/// <summary> 
/// <para>Main comment<br /> 
/// Line 1<br />
/// Line 2</para> 
/// </summary>
public bool TestLine { get; set; }

I'm just adding this for anyone using Xamarin Studio like I am. I found that none of the above solutions work for me, but this one did:

/// <summary>
/// Main summarry line.
/// <para></para>
/// <para></para>
/// Your secondary summary
/// </summary>

This gives the following output:

Summary  
Main summary line.

Your secondary summary

I would suggest using this formatting if you want multiple lines in the summary without making it complicated. It'll work if you use the <br /> tag after each line. (using it anywhere inside the text will make a new line where the tag is also.)

Although, note that if you have a space after the <br /> tag, you would get an extra space one the next line. So you wanna have the same amount of space on each line, so every row it'll be in a straight line.

/// <summary>
/// This is line 1<br />
/// This is line 2<br />
/// This is line 3<br />
/// </summary>
public bool TestLine { get; set; }