XElement::ReplaceAll Method (array<Object>)
Replaces the child nodes and the attributes of this element with the specified content.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
This method first removes existing content and attributes. It then adds the specified content.
This method uses snapshot semantics—that is, it creates a separate copy of the new content before replacing the contents of the current element with the new content. This means that you can query the contents of the current element and use the results of the query as the specified new content.
For details about the valid content that can be passed to this function, see Valid Content of XElement and XDocument Objects.
The following example passes the results of a LINQ query to this method, replacing the contents of an element with the query results.
This example produces the following output:
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.