Good suggestion, thanks. I've implemented this in the next release: https://feedback.objo.dev/feature/569
I’ve added this to Array.IndexOf() with two new overloads:
IndexOf(item As T, startIndex As Integer) As Integer
IndexOf(item As T, startIndex As Integer, count As Integer) As Integer
The returned index is the absolute array index, not relative to the searched range.
So your original use case can now be written as:
Var pos As Integer = theArray.IndexOf(searchValue)
While pos > -1
# Do something with pos
pos = theArray.IndexOf(searchValue, pos + 1)
Wend