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 code.

Syntax

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

The lang attribute is optional. It has two allowed values - VB and C#. If omitted, the code is general. If specified, the code is marked as C# or Visual Basic and can be filtered with language filter.

Examples

Visual Basic

''' <summary>Our sample property.</summary>

''' <example>This is an example how to use prop1 and prop2 properties:

''' <code>  Try

'''      If Me.prop1 &lt;&gt; &quot;hello&quot; Then

'''          prop2 = DllModule1.sampleEnum.value2

'''      End If

'''  Catch ex As nestedException

'''      prop2 = DllModule1.sampleEnum.value1

'''  End Try</code></example>

Property prop1() As String

C#

/// <summary>Our sample property.</summary>

/// <example>This is an example how to use prop1 and prop2 properties:

/// <code>  try {

///     if (this.prop1 != &quot;hello&quot;) {

///       prop2 = DllModule1.sampleEnum.value2;

///     }

///   }

///   catch (nestedException ex) {

///     prop2 = DllModule1.sampleEnum.value1;

///   }</code></example>

public string prop1

 

Note

Remember that XML comments must be well-formed XML. Therefore some characters cannot be used in attribute or 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;

The safest way to enter these characters is to use VSdocman WYSIWYG comment editor.

See Also