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

前端 未结 5 1145
长情又很酷
长情又很酷 2020-12-05 09:15

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

相关标签:
5条回答
  • 2020-12-05 09:29

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

    0 讨论(0)
  • 2020-12-05 09:32

    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.

    0 讨论(0)
  • 2020-12-05 09:41

    Would &lt; work?

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

    0 讨论(0)
  • 2020-12-05 09:49

    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

    0 讨论(0)
  • 2020-12-05 09:53

    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

    0 讨论(0)
提交回复
热议问题