【发布时间】:2010-08-08 12:33:45
【问题描述】:
我有问题 LINQ 查询。在上面,我得到错误 system.object 无法转换为 Sytem.String。可能是什么问题?
如果我使用 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
【问题讨论】: