Problem
This should be a piece of cake…
In my code, I’d like to add a “coded” line break to the XML description.
/// <summary>
/// Get a human-readable variant of the SQL WHERE statement of the search element. <br/>
/// Rather than return SQL, this method returns a string with icon-tokens, which
/// could be used to represent the search in a condensed pictogram format.
/// </summary>
As you can see, I discovered a few replies that showed how to use the and > brackets. In the Intellisense popup, the good ‘ol br/ > line break does not produce a line break.
This irritates me…
Any suggestions?
Asked by Tinkerer_CardTracker
Solution #1
You can use a tag to produce a paragraph break or you can wrap text in tags as a way to group the text and add the blank line after it, but there is no equivalent to
or anything like that. (Which according to this old MS forum post is by design.) You can get the list of available tags in this documentation article from MS. Documenting your code
(Based on the original OP sample):
/// <summary>
/// <para>Get a human-readable variant of the SQL WHERE statement of the search element.</para>
/// Rather than return SQL, this method returns a string with icon-tokens, which
/// could be used to represent the search in a condensed pictogram format.
/// </summary>
Answered by pstrjds
Solution #2
Use br/> for newlines in comments starting with Visual Studio 2019.
Example:
/// <summary>
/// This is a comment.<br/>
/// This is another comment <br/>
/// This is a long comment so i want it to continue <br/> on another line.
/// </summary>
When we use br/> instead of para>, there is no additional line added.
Answered by Mahipal
Solution #3
This is how I use it, and it works for me:)
/// <summary>
/// Value: 0/1/2
/// <para/>0 foo,
/// <para/>1 bar,
/// <para/>2 other
/// </summary>
Answered by IlPADlI
Solution #4
Add a tag with a special char in it, the 255 char, or invisible char.
/// <summary>
/// Some text
/// <para> </para>
/// More text
/// </summary>
/// <param name="str">Some string</param>
public void SomeMethod(string str) { }
This is how it will work:
Answered by Joel
Solution #5
br>/br> and br /> don’t appear to work, and sometimes the urge to have a blank line for worry separation is more important than having the para> phrases separate. This is something I’m bringing up because this question appears to be the father of a lot of similar closed queries.
The only thing that worked for me was
<para> </para>
For example
/// <summary>
/// <para>
/// "This sentence shows up when the type is hovered"
/// </para>
/// <para> </para>
/// <para>int PrimaryKey</para>
/// <para> </para>
/// <para>virtual Relation Relation</para>
/// </summary>
Results in
"This sentence shows up when the type is hovered"
int PrimaryKey
virtual Relation Relation
Answered by Travis J
Post is based on https://stackoverflow.com/questions/7279108/how-to-add-a-line-break-in-c-sharp-net-documentation