XElement.IsEmpty Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets a value indicating whether this element contains no content.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
The following example creates a variety of XML trees, and shows the value of this property with each tree.
StringBuilder output = new StringBuilder(); XElement el1 = new XElement("Root"); output.Append(el1 + Environment.NewLine); output.Append(el1.IsEmpty + Environment.NewLine); output.Append(Environment.NewLine); XElement el2 = new XElement("Root", "content"); output.Append(el2 + Environment.NewLine); output.Append(el2.IsEmpty + Environment.NewLine); output.Append(Environment.NewLine); XElement el3 = new XElement("Root", ""); output.Append(el3 + Environment.NewLine); output.Append(el3.IsEmpty + Environment.NewLine); output.Append(Environment.NewLine); el3.ReplaceAll(null); output.Append(el3 + Environment.NewLine); output.Append(el3.IsEmpty + Environment.NewLine); OutputTextBlock.Text = output.ToString();
Show: