XElement.HasElements Property

Gets a value indicating whether this element has at least one child element.

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

'Declaration
Public ReadOnly Property HasElements As Boolean

Property Value

Type: System.Boolean
true if this element has at least one child element; otherwise false.

The following example uses this property.


Dim output As New StringBuilder
Dim xmlTree1 As XElement = _
        <Root>
            <Child>1</Child>
        </Root>
output.Append(xmlTree1.HasElements)
output.Append(Environment.NewLine)

Dim xmlTree2 As XElement = <Root>contents</Root>
output.Append(xmlTree2.HasElements)
output.Append(Environment.NewLine)


OutputTextBlock.Text = output.ToString()


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: