Compartilhar via


XML Comment Literal (Visual Basic)

A literal representing an XComment object.

<!-- content -->

Parts

Term

Definition

<!--

Required. Denotes the start of the XML comment.

content

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.

Return Value

An XComment object.

Remarks

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

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 XComment constructor.

Example

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

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

See Also

Reference

XML Element Literal (Visual Basic)

XComment

Other Resources

XML Literals (Visual Basic)

Creating XML in Visual Basic