【问题标题】:How to specify language in xml comment <code> tag如何在 xml 注释 <code> 标签中指定语言
【发布时间】:2011-09-13 14:25:01
【问题描述】:

有没有办法指定在 XML cmets 中 &lt;example&gt; 标记中使用的 &lt;code&gt; 标记中使用的语言?

我正在使用 Sandcastle Help File Builder 测试来自我的 XML cmets 的构建文档,但是当我在示例部分中包含 VB.net 代码示例时,它会将它们显示为“C#”,而不是 vb.net。不知道我是否还有其他需要做的事情......

这是我正在尝试制作的 XML cmets。

        /// <summary>
        /// Creates and sends an email.
        /// </summary>
        /// <param name="subject">A <c>String</c> that contains the subject text.</param>
        /// <param name="emailBody">A <c>String</c> that contains the message body.</param>
        /// <param name="emailFrom">A <c>String</c> that contains the address of the sender of the e-mail message.</param>
        /// <param name="emailTo">A <c>String</c> that contains the addresses of the recipients of the e-mail messa</param>
        /// <param name="emailBCC">The email address to blind carbon-copy the email to.</param>
        /// <param name="IsHtml">if set to <c>true</c> [the body of the email HTML].</param>
        /// <param name="attachment">The <c>System.Net.Mail.Attachment</c> to the email.</param>
        /// <exception cref="ArgumentNullException"><c>emailFrom</c> is null or <c>emailTo</c> is null.</exception>
        /// <exception cref="ArgumentException"><c>emailFrom</c> is <c>Empty</c> ("") or <c>emailTo</c> is <c>Empty</c> ("").</exception>
        /// <example>
        /// <code>
        /// string subject = "This is my subject.";
        /// string[] emailBody = new {"body line 1", "body line 2"};
        /// string emailFrom = "test@test.com";
        /// string emailTo = "recipient@test.com";
        /// string emailBCC = string.empty;
        /// bool isHTML = false;
        /// 
        /// EmailWithComments.SendEmail(subject, emailBody, emailFrom, emailTo, emailBCC, isHTML, null);
        /// </code>
        /// <code>
        /// Dim subject As String = "This is my subject."
        /// Dim emailBody As String() = New From { _
        ///     "body line 1", _
        ///     "body line 2" _
        /// }
        /// Dim emailFrom As String = "test@test.com"
        /// Dim emailTo As String = "recipient@test.com"
        /// Dim emailBCC As String = String.empty
        /// Dim isHTML As Boolean = False
        ///
        /// EmailWithComments.SendEmail(subject, emailBody, emailFrom, emailTo, emailBCC, isHTML, Nothing)
        /// </code>
        /// </example>

【问题讨论】:

  • 如果您还不知道 msdn.microsoft.com/en-us/library/5ast78ax.aspx 似乎是 XML 的文档。 codeexample 似乎都没有任何设置语言的选项,所以我怀疑你可能不走运。 :(
  • 是的,我在看,没看到。试图弄清楚 MSDN 如何为不同的编程语言制作示例。

标签: c# xml xml-comments


【解决方案1】:

Sandcastle 帮助文件生成器extends the code tag 并支持lang 属性。

【讨论】:

  • 从仅链接的答案扩展它:在这种情况下,它将是 &lt;code language="cs"&gt; ... &lt;code&gt;
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-03
  • 2020-10-10
  • 2015-07-18
  • 2018-10-08
  • 2021-12-21
  • 2020-07-20
相关资源
最近更新 更多