How to get the indexes inside the array With Condition 'LINQ'

Mansour_Dalir 2,036 Reputation points
2023-07-24T13:26:30.26+00:00

hi

Dim MyArray as String={"a","b","c","a","b","h","a"}

Dim condition_item_is="a"

ArrResault={0,3,6} thank..

Developer technologies | VB
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-07-24T13:38:17.5933333+00:00

    For example:

    Dim result As Integer() = MyArray.Select(Function(v, i) New With {v, i}).Where(Function(p) p.v = condition_item_is).Select(Function(p) p.i).ToArray
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.