繁体   English   中英

将注释放在我的C#XML注释块中的XML中

[英]Putting comments in XML that is present in my C# XML comment blocks

我在XML注释中使用代码示例块作为一种简单的方法,让用户了解XML的外观。 这是一个非常粗略的解决方案,最终将为用户提供xml字符串的XML Schema。 但是,现在我将在我的基于doxygen的文档中提供这些信息。

例如,我有这样的事情:

/// <example>
/// <code>
///   <!-- xml will go below this comment, but I can't display the comment! -->
/// </code>
/// </example>

当我查看我的文档时,任何有注释的行都会显示为空白行。

我试过逃避&lt; &gt; ,并尝试使用<CDATA[<!-- comment -->]]> ,但没有成功。 转义序列按原样显示, CDATA按原样显示,但不显示字符数据。

我在这里想念的是什么? :)

编辑 - 我需要澄清这不是Intellisense呈现信息的问题。 我希望在Doxygen渲染到CHM时(通过HTML Help Workshop)正确显示XML注释。

当你尝试使用&lt;转义时 &gt; ,你使用这种语法吗?

/// <example>
/// <code>
///   &lt;!-- xml will go below this comment, but I can't display the comment! --&gt;
/// </code>
/// </example>

它适用于IntelliSense,我认为没有任何理由不应该在其他地方工作。

IntelliSense截图

编辑 :你能试试下面的版本吗?

/// <example>
/// <pre lang='xml'> 
///   &lt;!-- xml will go below this comment, but I can't display the comment! --&gt;
/// </pre> 
/// </example>

我不确定你的XML源出现在哪里,是在函数或类的文档中? 如果是这样,请尝试将XML包装在verbatim\\endverbatim标记中。 对于以下示例

/** A test class with some XML in the documentation.

 \verbatim
 <example>
 <code>
   <!-- xml will go below this comment, but I can't display the comment! -->
 </code>
 </example>
 \endverbatim
*/
class Test
    ...

我得到了doxygen输出:

在此输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM