Bewerken

Share via


XText Constructors

Definition

Initializes a new instance of the XText class.

Overloads

XText(String)

Initializes a new instance of the XText class.

XText(XText)

Initializes a new instance of the XText class from another XText object.

XText(String)

Source:
XText.cs
Source:
XText.cs
Source:
XText.cs

Initializes a new instance of the XText class.

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

Parameters

value
String

The String that contains the value of the XText node.

Examples

The following example creates an element that contains a text node.

XElement root = new XElement("Root", "Some text");  
Console.WriteLine(root);  
Dim root As XElement = <Root>Some text</Root>  
Console.WriteLine(root)  

This example produces the following output:

<Root>Some text</Root>  

Remarks

You typically do not create text nodes by using the XText constructors. When you pass text content when constructing an XElement, text nodes are automatically created.

See also

Applies to

XText(XText)

Source:
XText.cs
Source:
XText.cs
Source:
XText.cs

Initializes a new instance of the XText class from another XText object.

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

Parameters

other
XText

The XText node to copy from.

Remarks

This constructor is primarily used internally to make a deep copy of an XML tree.

See also

Applies to