XML descendant elements cannot be selected from type 'type'

An XML descendant has been referenced for an object that is not of type XElement, XDocument, or IEnumerable(Of XElement). For more information, see XML Descendant Axis Property.

' Generates an error.
Dim var = "sample text"...<childElement>

Error ID: BC36809

To correct this error

  • Ensure that the object of which you are referencing a descendant element is strongly typed as XElement, XDocument, or IEnumerable(Of XElement). Following is an example:

    Dim elem As XElement = <root>
                            <child />
                           </root>
    Dim var = elem...<child>
    

See Also

Reference

XML Descendant Axis Property

Other Resources

XML Axis Properties

XML in Visual Basic