Special Characters in XML Comments

Something that I’ve come across a few times now is the need to include special characters in XML comments for custom methods. Specifically, when trying to show that a parameter or return is a List of something, how does one show the < and > in List<IEdmTransition10>?

I kept trying to use ‘\’ or ‘\\’ as escape characters, but that was completely the wrong tactic. XML is more of a web thing, so I need to use &lt; and &gt; instead.

List&lt;IEdmTransition10&gt;

It’s not readable at all, but it does show up correctly.

Another thing to note is that, for whatever reason, these XML comments do not work with method extensions. Very annoying, but what can you do?

I found this information in this StackOverflow link: https://stackoverflow.com/a/4377408

Leave a Comment