This documentation is archived and is not being maintained.

XML Comment Literal (Visual Basic)

A literal representing an XComment object.

<!-- content -->




Required. Denotes the start of the XML comment.


Required. Text to appear in the XML comment. Cannot contain a series of two hyphens (--) or end with a hyphen adjacent to the closing tag.


Required. Denotes the end of the XML comment.

XML comment literals do not contain document content; they contain information about the document. The XML comment section ends with the sequence "-->". This implies the following points:

  • You cannot use an embedded expression in an XML comment literal because the embedded expression delimiters are valid XML comment content.

  • XML comment sections cannot be nested, because content cannot contain the value "-->".

You can assign an XML comment literal to a variable, or you can include it in an XML element literal.

Note Note

An XML literal can span multiple lines without using line continuation characters. This feature enables you to copy content from an XML document and paste it directly into a Visual Basic program.

The Visual Basic compiler converts the XML comment literal to a call to the #ctor constructor.

The following example creates an XML comment that contains the text "This is a comment".

Dim com As XComment = <!-- This is a comment -->