簡體   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