XElement Constructor (XStreamingElement)
Collapse the table of content
Expand the table of content

XElement Constructor (XStreamingElement)

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

Initializes a new instance of the XElement class from an XStreamingElement object.

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

'Declaration
Public Sub New ( _
	other As XStreamingElement _
)

Parameters

other
Type: System.Xml.Linq.XStreamingElement
An XStreamingElement that contains unevaluated queries that will be iterated for the contents of this XElement.

This constructor iterates through the contents of the specified XStreamingElement, and creates an element with its contents.

The following example creates a source XML tree, and then creates an XStreamingElement from a query on the source XML tree. It then serializes the XStreamingElement to the console, adds a new element to the source XML tree, and then serializes the XStreamingElement again. You can see that element newly added to the source XML tree is not included in the first serialization, but is included in the second.


Dim output As New StringBuilder
Dim src As XElement = _
        <Root>
            <Child1>1</Child1>
            <Child2>2</Child2>
            <Child3>3</Child3>
        </Root>
Dim xse As XStreamingElement = New XStreamingElement("NewRoot", _
        From el In src.Elements() _
        Where (CInt(el) >= 2) _
        Select el _
)
output.Append(xse)
output.Append(Environment.NewLine)
src.Add(New XElement("Child4", 4))
output.Append("----")
output.Append(Environment.NewLine)
output.Append(xse)
output.Append(Environment.NewLine)

OutputTextBlock.Text = output.ToString()


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft