Adding line breaks to comments for Intellisense

30,092

Solution 1

Try using this.

/// <summary>
/// <para>Paragraph 1.</para>
/// <para>Paragraph 2.</para>
/// </summary>

But I don't think you can have an actual empty line. Empty para tag gets ignored.

Solution 2

Try this:

/// <summary>
/// <para> [Non-Breaking Space] </para>
/// </summary>

[Non-Breaking Space] is obtained using Alt+255 (using the Numpad).

It will show up as an empty new line. I know this is old, but it worked for me today.

Solution 3

/// <summary><br />
/// <para>To treat comment line like a DIV tag, surround them with PARA tags.</para><br />
/// <para>To add a break with whitespace, add the following line:</para><br />
/// <para>&#160;</para><br />
/// </summary>

Solution 4

Your only hope is probably something cludgy like this:

/// <summary>
/// <para>line one</para>
/// <para>_</para>
/// <para>line two</para>
/// </summary>
Share:
30,092

Related videos on Youtube

flesh
Author by

flesh

Updated on July 05, 2022

Comments

  • flesh
    flesh about 2 years

    Does anyone know how to insert a line break into a summary comment in order for the line break to be reflected in Intellisense documentation?

    To clarify, assume code documentation..

    /// <summary>
    /// Some text documentation
    ///  - a line break - 
    /// Some more documentation
    /// </summary>
    public void SomeMethod() { }
    

    So when using this method Intellisense offers a summary for the method formatted like this:

    Some text documentation

    Some more documentation

    (Note - the 'para' tag doesn't create empty line breaks - I've tried it!)

    • SoLaR
      SoLaR over 6 years
      A "para" is half answer (it's actually double break), beginning and end of line gets truncated. To enforce break a line at the beginning and the end of summary add following "<para>&#129;</para>" (&#129; character get omitted - actually non visible and zero space).
    • Mahipal
      Mahipal almost 5 years
      As of Visual Studio 2019, you can add line breaks using <br/> in xml documentation. Refer the answer here.
  • flesh
    flesh over 15 years
    nope that doesn't do it either ...
  • flesh
    flesh over 15 years
    how does MS do it with exceptions in methods for example?
  • flesh
    flesh over 15 years
    cludgy yes, but thats as close as ive got so far
  • bdukes
    bdukes over 15 years
    Exceptions are separate tags in the XML. It's not a blank line in the summary, it's just rendering different sections of the documentation
  • drzaus
    drzaus about 12 years
    <br /> alone worked for me. Using the <para> tags created too much padding which pushed the rest of my comments beyond the overflow.
  • Louis Kottmann
    Louis Kottmann almost 12 years
    +1: I finally have a place to write //Magic, do not touch.
  • Joel
    Joel about 11 years
    Just something I want to say: WOW!
  • Krowi
    Krowi about 10 years
    <para>&#160;</para> was the thing I was looking for, tnx :)
  • Daryl
    Daryl almost 10 years
    That maybe the most awesome and yet horrible thing to happen simultaneously at so many of the same levels that I have ever seen. For adding empty lines, I'll use Al Erickson's suggestion of &#160; but for doing indenting, this is way nicer.
  • Phil Lambert
    Phil Lambert almost 10 years
    Ladies and gentlemen, we have a winner!
  • Peter Huber
    Peter Huber over 9 years
    A slightly nicer version: /// <summary> /// <para>Paragraph 1.</para> /// <para>Paragraph 2.</para> /// </summary>
  • Peter Huber
    Peter Huber over 9 years
    Sorry for the ugly formatting, but stupid stackoverflow does not allow to change a comment after 5 minutes and prevents any decent formatting anyway. Proper sample see in next comment.
  • Peter Huber
    Peter Huber over 9 years
    Basically replace "<para>XYZ</para>" by "XYZ<para/>"
  • Robino
    Robino over 9 years
    Oldsk00L! That brings me back.
  • Jack Pettinger
    Jack Pettinger almost 9 years
    Get in my son! Fantastic
  • Martin Braun
    Martin Braun almost 9 years
    Alt + 0173 looks more like magic. It's the invisible character and works, too.
  • Arvo Bowen
    Arvo Bowen over 8 years
    How is there no accepted answer on this question? This should 100% be the accepted answer! Looking back, I guess the question was just asked badly. I'm sure the question was meant to ask how to insert a carriage return.
  • srh
    srh about 7 years
    how to use Alt+255 in VS 2015? when i try Alt+255 in VS 2015 nothing happens
  • David
    David over 6 years
    <br /> doesn't work in VS 2017.
  • Tam Le
    Tam Le about 4 years
    <br/> DOES work in VS 2019.