無法從型別 'type' 中選取 XML 子代項目

更新:2007 年 11 月

已針對型別不是 XElementXDocument 或 IEnumerable(Of XElement) 的物件參考 XML 子代 (Descendant)。如需詳細資訊,請參閱 XML 子代軸屬性

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

錯誤 ID:BC36809

若要更正這個錯誤

  • 請確定您正在參考其子代項目的物件,都屬於 XElementXDocument 或 IEnumerable(Of XElement) 強型別。下列為範例:

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

請參閱

參考

XML 子代軸屬性

其他資源

XML 軸屬性

Visual Basic 中的 XML