Value Property
Collapse the table of content
Expand the table of content

XText.Value Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the value of this node.

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

public string Value { get; set; }

Property Value

Type: System.String
A String that contains the value of this node.

Setting this property will raise the Changed and the Changing events.

The following example shows getting and setting this property.


StringBuilder output = new StringBuilder();
XElement root = new XElement("Root", "Some text");
XText txtNode = root.Nodes().OfType<XText>().First();
output.Append(txtNode.Value + Environment.NewLine);
txtNode.Value = "New text";
output.Append(txtNode.Value + Environment.NewLine);

root.Value = "Newer text";
txtNode = root.Nodes().OfType<XText>().First();
output.Append(txtNode.Value + Environment.NewLine);

OutputTextBlock.Text = output.ToString();


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft