I would like to be able to run a LINQ query on a BindingList (Of T) that returns indexes where the list item is equal to a specific value.
Let's say I have a list of simple widget objects of a class:
Public Class widget Public Property foo As Integer Public Property bar As String End Class Dim widgetList As BindingList(Of widget)
I would like to be able to request something like below from the list:
Dim test As Integer = 5 Dim index = (From i In widgetList Where i.foo = test Select i.index).First
So the index contains the index of the first listItem, where widgetList.Item (index) .foo = 5. What is the best way to do this? (Or should I use LINQ)
I have seen several C # methods for this, but Im not sure enough about C # to figure out how to use them in VB
source share