我在SQL Server 2008r2中使用实体框架6。 我有一个绑定源:
Mybindingsource.datasource=(From t in context.myobjects order by t.name select t).ToList
现在,我想在绑定源中搜索,并获取找到的项目的索引。
我正在使用此代码:
Function findindex(startposition as integer) As integer
Dim p as Myobject
Dim i as integer
For i=startposition to Mybindingsource.count-1
p=MyBindingsource.item(i)
if p.value=3 then return i
Next
return 0
End Function
此代码有效,但是当bindingsource包含太多itmes时,速度非常慢。
有没有更快的方法?
谢谢!