我正在尋找一種解決方案,開始在.net Framework 2.0中生活,現在已經升級到Framework 4.0,所以我可能會缺少必需的參考和/或Imports
線的地方,我想......Aggregate X Into Count()is not accessible
我已經得到形式LINQ查詢:
Dim x = Aggregate myDataRow As System.Data.DataRow In myDataTable _
Where (booleanCondition1) _
AndAlso (booleanCondition2) _
AndAlso (booleanCondition3) _
Into Count()
我得到的編譯錯誤「Definition of method 'Count' is not accessible in this context
」。
據我所知,從the literature Count()函數應該是可用的(顯然應該註冊爲關鍵字)。
我在做什麼錯?
編輯:
我只是改變了我的代碼,以直線選擇方法,像這樣:
Dim x = (From myDataRow As System.Data.DataRow In myDataTable _
Where (booleanCondition1) _
AndAlso (booleanCondition2) _
AndAlso (booleanCondition3) _
Select myDataRow)
,當我試圖讓x的.Count
,我得到的消息「'Count' is not a member of 'System.Data.EnumerableRowCollection(Of System.Data.DataRow)
」和according to the MSDN, it is。
完全困惑,現在。
作爲文檔指向的內容,您是否有對「System.Data.DataSetExtensions.dll」的引用和「System.Data」的導入? – Ocelot20
如果只使用Enumerable擴展方法,或者可能'System.Core.dll'並導入'System.Linq'。 – Ocelot20
我沒有'System.Data'導入,碰巧,但添加它似乎沒有幫助。我剛剛在對象瀏覽器中訪問過System.Data.EnumerableRowCollection,它似乎根本沒有任何成員...... Curiouser和curiouser。 – Frosty840