我有問題的LINQ查詢。在上面,我得到錯誤system.object不能被轉換爲Sytem.String。可能是什麼問題?LINQ中ArrayList問題
如果我使用string()而不是ArrayList,它不會引發錯誤。但是在String()中,我應該手動添加項目
Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
Dim movies As New ArrayList()
Dim dt As DataTable = StaticData.Get_Data(StaticData.Tables.LU_TAG)
For Each row As DataRow In dt.Rows
movies.Add(row.Item("DS_TAG"))
Next
Return (From m In movies _
Where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) _
Select m).Take(count).ToArray()
End Function
謝謝,我試過後發佈在這裏:)它的工作。謝謝 – ceee 2010-08-08 12:41:17