【发布时间】:2019-03-19 14:26:48
【问题描述】:
我的班级给了我一个错误:
Error 4 Expression of type 'System.Collections.Generic.IEnumerable(Of System.Xml.Linq.XElement)' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.
我搜索了类似的问题,发现导入/引用可能有问题。但是,我想我导入了我需要的所有东西,但它仍然给了我错误。
类和项目参考如下:
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Data
Imports System
Imports System.Xml
Imports System.Xml.Linq
Public Class Form1
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Dim Result As Integer
Dim mxldDataParams As System.Xml.Linq.XDocument = XDocument.Load("mypath\myxml.xml")
Private Function GetProcedureName(ByVal Name As String) As String
Dim Result As String = String.Empty
'this line gives the error
Dim Elems As System.Collections.Generic.IEnumerable(Of XElement) = From Elem As XElement In mxldDataParams.Root.Elements Where Elem.Name.LocalName = "data" And Elem.@name = Name
For Each Elem As XElement In Elems
Result = Elem...<target>...<remote>...<source>.@name
Exit For
Next
Return Result
End Function
End Class
【问题讨论】:
标签: vb.net .net-3.5 smart-device