The <code> tag gives you a way to indicate multiple lines as code. Use <c> to indicate that text within a description should be marked as a code.

Syntax

<code lang="C#|VB">text</code>

The lang attribute is optional. It has two allowed values - VB and C#. Alternative values for C# are csharp and cs (case insensitive). Alternative values for VB are VB.NET and vbnet (case insensitive). If the lang attribute is omitted, the code is general. If specified, the code is marked as C# or Visual Basic and can be filtered with language filter.

Examples

 

Note

Remember that XML comments must be a well-formed XML. Therefore some characters cannot be used in an attribute or a tag value. Those characters often appear in the source code so you have to be careful especially when using <code> or <c> tags. You must escape the following characters:

Character

Escape sequence

quote (")

&quot;

apostrophe (')

&apos;

ampersand (&)

&amp;

less than (<)

&lt;

greater than (>)

&gt;

Or if the code is longer, you can use <![CDATA[ ... ]]>. This is what comment editor does. The code is then more readable. The safest way to enter these characters is to use VSdocman WYSIWYG comment editor.

See Also