XComment Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy XComment.

Przeciążenia

XComment(String)

Inicjuje XComment nowe wystąpienie klasy z określoną zawartością ciągu.

XComment(XComment)

Inicjuje XComment nowe wystąpienie klasy z istniejącego węzła komentarza.

XComment(String)

Inicjuje XComment nowe wystąpienie klasy z określoną zawartością ciągu.

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)

Parametry

value
String

Ciąg zawierający zawartość nowego XComment obiektu.

Wyjątki

Parametr value to null.

Przykłady

Poniższy przykład tworzy element zawierający komentarz jako węzeł podrzędny.

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)  

Ten przykład generuje następujące wyniki:

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

Zobacz też

Dotyczy

XComment(XComment)

Inicjuje XComment nowe wystąpienie klasy z istniejącego węzła komentarza.

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)

Parametry

other
XComment

Węzeł XComment do skopiowania.

Wyjątki

Parametr other to null.

Uwagi

Ten konstruktor jest używany głównie wewnętrznie do tworzenia głębokiej kopii drzewa XML.

Zobacz też

Dotyczy