XStreamingElement::Add Method (Object^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Adds the specified content as children to this XStreamingElement.

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

public:
void Add(
	Object^ content
)

Parameters

content
Type: System::Object^

Content to be added to the streaming element.

This constructor adds the specified content and attributes to the XStreamingElement. While it is often possible to construct the XStreamingElement in a single statement, it is sometimes more convenient to add content to the streaming element incrementally.

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 Objects1.

The following example creates a new XStreamingElement. It then adds two queries to the streaming element. The queries are not iterated until the streaming element is serialized.

No code example is currently available or this language may not be supported.

This example produces the following output:


                <NewRoot>
  <Child>1</Child>
  <DifferentChild>3</DifferentChild>
  <DifferentChild>4</DifferentChild>
  <DifferentChild>5</DifferentChild>
</NewRoot>

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: