我有一个对象数组列表,我想知道包含某个值的对象的数组列表中的索引,是否有内置方法来进行搜索?
我知道我可以简单地遍历数组列表以找到正确的值,例如:
ReportToFind="6"
For i = 0 To ReportObjList.Count - 1
If ReportObjList.Item(i).ReportCode = ReportToFind Then
ReportName.Text = ReportObjList.Item(i).ReportName ' found it - show name
Exit For
End If
Next
唯一的其他解决方案是将这段代码替换为二进制搜索吗?
.Net 1.1