Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XElement IsEmpty tells whether this element contains no content

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim el1 As XElement = <Root/>         Console.WriteLine(el1)         Console.WriteLine(el1.IsEmpty)         Console.WriteLine()         Dim el2 As XElement = <Root>content</Root>         Console.WriteLine(el2)         Console.WriteLine(el2.IsEmpty)         Console.WriteLine()         Dim el3 As XElement = <Root></Root>         Console.WriteLine(el3)         Console.WriteLine(el3.IsEmpty)         Console.WriteLine()         el3.ReplaceAll(Nothing)         Console.WriteLine(el3)         Console.WriteLine(el3.IsEmpty)     End Sub End Class