Mehdi
Mehdi

Reputation: 2283

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

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

Upvotes: 82

Views: 23227

Answers (5)

AlexMelw
AlexMelw

Reputation: 2624

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

Upvotes: 2

Iain
Iain

Reputation: 6452

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

Upvotes: 14

PhilMY
PhilMY

Reputation: 2651

Would &lt; work?

http://msdn.microsoft.com/en-us/library/5ast78ax.aspx

Upvotes: 10

Jon Skeet
Jon Skeet

Reputation: 1500665

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.

Upvotes: 125

Sebastian P.R. Gingter
Sebastian P.R. Gingter

Reputation: 6085

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

Upvotes: 17

Related Questions