XElement::IsEmpty Property
Gets a value indicating whether this element contains no content.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
Note that an element that contains a start and end tag with no content between the tags is not considered to be an empty element. It has content with no length. Only an element that contains only a start tag, and is expressed as a terminated empty element, is considered to be empty.
The following example creates a variety of XML trees, and shows the value of this property with each tree.
This example produces the following output:
<Root />
True
<Root>content</Root>
False
<Root></Root>
False
<Root />
True
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