15,851,387 members
See more:
Hello;
I have this List
VB
```Dim Lst as New List(of Array)

Can I search this list for an exact and get the index without using a loop.
For example search for 47, he will get found Lst(1)
Posted

## Solution 2

VB.NET
```Dim Lst As New List(Of Integer())

Dim index = Lst.FindIndex(Function(n) n.Contains(47))
```
Note that the `List` is a `List(of Integer())`. This enables you to call the `Contains()` method in the Lambda expression that is the predicate of the `FindNext()` method.

Member 9451601 15-Jan-14 14:15pm
I noticed you wrote List(of Integer()) Instead of List(of Array())
But you added an array and not an integer
So can you explain
Meshack Musundi 15-Jan-14 14:48pm
The arrays you are adding to your list are arrays of `Integer`s so it's a `List(Of Integer())` (List of Integer arrays). Note the opening and closing brace after `Of Integer`.

## Solution 1

Try this:
VB
```Dim Lst As New List(Of Array)
Dim arrIndex As Integer = -1
Dim i As Integer = 0
For Each arr As Integer() In Lst
If arr.Contains(47) Then
arrIndex = i
Exit For
End If
i += 1
Next
Console.WriteLine(arrIndex)
```

This will print `1`. If you search for an integer that doesn't exist, it will print `-1`

How this works: you iterate over each array in the `List`, and if that array contains `47`, the `arrIndex` variable will be set to the index of the array in the list.

v2