XStreamingElement Constructor (XName, Object[])

 

Initializes a new instance of the XStreamingElement class with the specified name and content.

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

public XStreamingElement(
	XName name,
	params object[] content
)

Parameters

name
Type: System.Xml.Linq.XName

An XName that contains the element name.

content
Type: System.Object[]

The contents of the element.

This constructor creates a streaming element with the specified content and attributes.

There is an implicit conversion from string to XName. Typical use of this constructor is to specify a string as the parameter instead of creating a new XName.

Queries are not iterated until the XStreamingElement is serialized. This is in contrast to using queries for content for an XElement, where queries are iterated at the time of construction of the new XElement.

For details about the valid content that can be passed to this function, see Valid Content of XElement and XDocument Objects.

This example uses the following XML file, named Source.xml:


                <?xml version="1.0" encoding="utf-8" ?> 
<Root>
  <Child Key="01">
    <GrandChild>aaa</GrandChild>
  </Child>
  <Child Key="02">
    <GrandChild>bbb</GrandChild>
  </Child>
  <Child Key="03">
    <GrandChild>ccc</GrandChild>
  </Child>
</Root>

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: