How to show '<' char in C# XML comments?

C#Xml

C# Problem Overview


I searched a lot, but couldn't find how to show '<' char in C# XML comments?

C# Solutions


Solution 1 - C#

Did you try the normal XML escaping of &lt; - that should work, I believe:

/// <summary>
/// Less than is &lt;
/// Greater than is &gt;
/// Ampersand is &amp;
/// </summary>

Basically it's normal XML.

Solution 2 - C#

You need to escape it as in normal XML: with &lt; Same goes for &gt; for >

Solution 3 - C#

You can use HTML escape codes, as mentioned in other answers, but you could also look at using the CDATA - (Unparsed) Character Data tag, here is a link with more info

Cheers

Solution 4 - C#

Solution 5 - C#

As @Eris mentioned we could also use

<summary cref="C{T}">

instead of

<summary cref="C &lt; T &gt;">

for sake of delimiting a generic type

See a nice example on MSDN

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMehdiView Question on Stackoverflow
Solution 1 - C#Jon SkeetView Answer on Stackoverflow
Solution 2 - C#Sebastian P.R. GingterView Answer on Stackoverflow
Solution 3 - C#IainView Answer on Stackoverflow
Solution 4 - C#PhilMYView Answer on Stackoverflow
Solution 5 - C#AlexMelwView Answer on Stackoverflow