Is there a way to specify what language is being used in the <code>
tag used within an <example>
tag in XML comments?
I am using Sandcastle Help File Builder to test building documentation from my XML comments, but when I include VB.net code samples in my example sections, it displays them as "C#", not vb.net. Not sure if there is something else I need to do...
Here is the XML comments I am trying to make.
/// <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 = "[email protected]";
/// string emailTo = "[email protected]";
/// 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 = "[email protected]"
/// Dim emailTo As String = "[email protected]"
/// Dim emailBCC As String = String.empty
/// Dim isHTML As Boolean = False
///
/// EmailWithComments.SendEmail(subject, emailBody, emailFrom, emailTo, emailBCC, isHTML, Nothing)
/// </code>
/// </example>
The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags.
Syntax. A comment starts with <! -- and ends with -->. You can add textual notes as comments between the characters.
Enabling XML Comments XML comments are enabled by default in Visual Basic projects, and cannot be disabled. To enable or disable XML comments for a specific project, go to the project properties page, the Compile tab, and update the "Generate XML documentation file" checkbox.
A comment is preceded by an double forward slash. The code of line after the double forward slash is simply ignored by the compiler. To code a comment, type an double forward slash followed by the comment. You can use this technique to add a comment on its own line or to add a comment after the code on a line.
Sandcastle Help File Builder extends the code tag and supports the lang
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With