XML注释 - MSDN文档“注意”部分 - 如何复制此内容?

时间:2011-09-12 20:28:01

标签: c# msdn sandcastle xml-comments

基本上,在MSDN在线帮助中,我经常遇到“注意”部分,但不能为我的生活弄清楚如何获得相同的输出。显然没有<note>标签。有谁知道如何使这个工作?

IDictionary(TKey, TValue) - 在这个例子中,如果你转到备注部分,你会看到我在说什么。

我正在使用Sandcastle帮助文件构建器。

3 个答案:

答案 0 :(得分:6)

实际上,Sandcastle和Sandcastle帮助文件构建器都支持<note>元素,尽管它非常隐蔽! :-)它只记录在我所知道的两个地方:

  1. 来自Dyncity的 XML文档评论指南引用...显然已不再在网络上提供 - 以前的链接为http://www.dynicity.com/downloads/default.aspx
  2. 我在Simple-Talk.com上发表的文章wallchart,标题为Taming Sandcastle: A .NET Programmer's Guide to Documenting Your Code。请注意,文章中有一个链接可以访问挂图,但它位于文章的最底部,所以我在这里给出了两个链接。 (我在文章中也提到了Dyncity的指南;我将与编辑人员沟通,看看他们是否想要托管现在的孤立Dyncity指南的本地副本,如果他们这样做,可以在这里发布更新。)
  3. 以下是<note>元素的所有文档。 (这是我的挂图; Dyncity指南基本上说的是相同的东西,但不那么简洁。)

    Syntax of note element

    遗憾的是,关于<note>我发现的所有文件都不充分。所以我进行了快速试用,将每个笔记类型嵌入备注部分。以下是它的产生:


    Sample Sandcastle note output

    也就是说,使用type="caution"可以获得警告图标和标签,而其他两个类型属性值在我的特定示例中生成相同的注释图标和标签。我怀疑它的使用可能还有其他方面深埋在灌木丛中。

答案 1 :(得分:2)

为了扩展cubrr对Bobby答案的评论,实际上现在有一些关于Sandcastle中Note元素的相当广泛的文档。

您可以将四种类别的注释添加到任何其他默认xml元素,例如备注或摘要元素。这些是一般,警告,安全或语言。它们之间的主要区别似乎是它们给出音符的图标类型以及音符旁边的标题。您可以查看所有这些备注类型here的完整列表。

以下代码为我生成了以下结果:

/// <remarks>
/// <note type="note">
/// This is a note in a remark. It is a General note.
/// </note>
/// <note type="tip">
/// This is a tip note in a remark. It is a General note.
/// </note>
/// <note type="implement">
/// This is a implement note in a remark. It is a General note.
/// </note>
/// <note type="caller">
/// This is a caller note in a remark. It is a General note.
/// </note>
/// <note type="inherit">
/// This is a inherit note in a remark. It is a General note.
/// </note>
/// <note type="caution">
/// This is a caution note in a remark. It is a Cautionary note.
/// </note>
/// <note type="important">
/// This is a important note in a remark. It is a Cautionary note.
/// </note>
/// <note type="security">
/// This is a security note in a remark. It is a Security note.
/// </note>
/// <note type="cs">
/// This is a cs note in a remark. It is a Language note.
/// </note>
/// </remarks>

结果: Generated Help File

答案 2 :(得分:1)

关于Sandcastle的文档很少,但是注释输出可能来自Sandcastle,而不是C#的原生XML注释标记。

您可以尝试使用以下代码放置注释部分并查看Sandcastle输出的内容(过去支持不确定是否已更改):

<alert class="note">This is a 'alert class=note'</alert>

有关详细信息,请参阅:Microsoft Assistance Markup Language Longhorn Help