一个C#总结注释中的Xml字符串 [英] Xml string in a C# summary comment
问题描述
但是,这会抛出一个错误:格式错误的XML - 一个名称以无效字符开头。有没有任何可以使用的转义字符序列来嵌入我的C#总结评论中的XML?
使用标准XML转义,例如:
< summary>这需要& lt; token1& gt,并将其变成& lt; token2& gt;< ; / summary>
键入或读取代码并不容易,但IntelliSense正确解除了您在工具提示中看到正确的,可读的东西。
I'm documenting a few methods I wrote in C# that deal with parsing tokens. Due to some technical restraints in other areas of the system, these tokens need to take the form of XML elements (i.e., <tokenName />
). I'd like to put the format of those tokens in the summary statement itself.
However, this throws an error: Badly formed XML -- A name was started with an invalid character". Is there any sort of escape character sequence I can use to embed XML in my C# summary comments?
Use standard XML escaping. For example:
<summary>This takes a <token1> and turns it into a <token2></summary>
It's not super-easy to type or read as code, but IntelliSense properly unescapes this and you see the right, readable thing in the tooltip.
这篇关于一个C#总结注释中的Xml字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!