Adding line breaks to c comments for Intellisense
Data Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.
Introduction
To add line breaks in C# XML documentation comments that display in IntelliSense, use the <para> tag to create paragraph breaks or <br/> for line breaks. Standard newlines in XML comments are collapsed into a single space by IntelliSense. The <para> tag is the officially supported approach and works reliably across Visual Studio versions. The <br/> tag works in some versions but is not part of the official XML documentation spec.
Basic XML Comment Structure
In the second example, IntelliSense shows: "This spans multiple lines in the source code but IntelliSense displays it as ONE line because XML collapses whitespace and newlines."
Using <para> for Paragraph Breaks
IntelliSense renders each <para> block as a separate paragraph with spacing between them.
Using <br/> for Line Breaks
Note: <br/> works in Visual Studio but is not part of the official C# XML documentation tags. Some documentation generators (Sandcastle, DocFX) may ignore it.
Using <list> for Structured Content
For bullet points or numbered lists, use the <list> tag:
Using <remarks> for Extended Documentation
Using <code> and <c> for Code in Comments
<c> renders inline code. <code> renders a code block (preserves whitespace and line breaks).
Complete Example
Common Pitfalls
- Expecting newlines to render in IntelliSense: XML collapses all whitespace (spaces, tabs, newlines) into a single space. Line breaks in the source code
///comments do not produce line breaks in IntelliSense. You must use<para>or<br/>tags explicitly. - Using
<br/>for portable documentation:<br/>works in Visual Studio IntelliSense but is not part of the official C# XML documentation tags. Documentation generators like DocFX, Sandcastle, or NuGet package documentation may ignore or strip<br/>tags. Use<para>for maximum compatibility. - Nesting
<para>inside<para>: The<para>tag creates a paragraph block. Nesting one<para>inside another produces invalid XML documentation. Use sibling<para>tags at the same level for multiple paragraphs. - Forgetting the closing tag on
<list>items:<list>requires<item>and<description>child elements with proper closing tags. Malformed XML silently breaks IntelliSense tooltips — the entire summary may stop displaying. Check the Error List window for XML comment warnings. - Using
&,<,>without escaping: XML comments are parsed as XML. Literal<must be<,>must be>, and&must be&. Writing/// Returns true if a < bbreaks the XML parser. Use<c>a < b</c>or rephrase to avoid special characters.
Summary
- Use
<para>tags to create paragraph breaks in XML documentation comments — standard newlines are collapsed - Use
<list type="bullet">or<list type="number">for structured bullet/numbered lists in IntelliSense - Use
<c>for inline code and<code>for multi-line code blocks (preserves formatting) - Place extended documentation in
<remarks>to separate the brief summary from detailed notes - Escape XML special characters (
<,>,&) in documentation comments to avoid parse errors
Related reading
- Adding List<T>.Add another list
- Adding scripting functionality to .NET applications
- Adding string to StringBuilder from async method
- Adjusting CommandTimeout in Dapper.NET?
- Adjusting decimal precision, .net
- ADO Async all the way down the tubes?
- ADO.NET Entity Framework Update Wizard will not add tables
- Algorithm for implementing C yield statement

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.