XComment Constructeurs

Définition

Initialise une nouvelle instance de la classe XComment.

Surcharges

Nom Description
XComment(String)

Initialise une nouvelle instance de la XComment classe avec le contenu de chaîne spécifié.

XComment(XComment)

Initialise une nouvelle instance de la XComment classe à partir d’un nœud de commentaire existant.

XComment(String)

Initialise une nouvelle instance de la XComment classe avec le contenu de chaîne spécifié.

public:
 XComment(System::String ^ value);
public XComment(string value);
new System.Xml.Linq.XComment : string -> System.Xml.Linq.XComment
Public Sub New (value As String)

Paramètres

value
String

Chaîne qui contient le contenu du nouvel XComment objet.

Exceptions

Le value paramètre est null.

Exemples

L’exemple suivant crée un élément qui contient un commentaire en tant que nœud enfant.

XElement root = new XElement("Root",
    new XComment("This is a comment")
);
Console.WriteLine(root);
Dim root As XElement = <Root>
                           <!--This is a comment-->
                       </Root>
Console.WriteLine(root)

Cet exemple produit la sortie suivante :

<Root>
  <!--This is a comment-->
</Root>

Voir aussi

S’applique à

XComment(XComment)

Initialise une nouvelle instance de la XComment classe à partir d’un nœud de commentaire existant.

public:
 XComment(System::Xml::Linq::XComment ^ other);
public XComment(System.Xml.Linq.XComment other);
new System.Xml.Linq.XComment : System.Xml.Linq.XComment -> System.Xml.Linq.XComment
Public Sub New (other As XComment)

Paramètres

other
XComment

Nœud XComment à partir duquel copier.

Exceptions

Le other paramètre est null.

Remarques

Ce constructeur est principalement utilisé en interne pour effectuer une copie approfondie d’une arborescence XML.

Voir aussi

S’applique à