Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XContainer ReplaceNodes replaces the children nodes of this document or element with the specified content

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()     Dim root As XElement = _          <Root>             <Child>1</Child>             <Child>2</Child>             <Child>3</Child>             <Child>4</Child>             <Child>5</Child>         </Root>     root.ReplaceNodes( _         From el In root.Elements _         Where el.Value >= 3 _         Select el)     Console.WriteLine(root)     End Sub End Class