How to search in 2D array by LINQ (VB.NET)

Private Sub SearchCardID(ByVal score As Integer)

 Dim scoreCardID As String(,)
 Try

    scoreCardID = New String(,) {{"1", "1000000001"}, {"4", "1234567890"}, {"6", "1005001234"}}

     Dim cardID = From i In Enumerable.Range(0, scoreCardID.GetLength(0)) _
                         Where scoreCardID(i, 0) = score.ToString _
                         Select scoreCardID(i, 1)

     Debug.Print("Score=" & score & ";CardID=" & cardID(0))

 Catch ex As Exception
     MsgBox(ex.ToString)
 End Try

End Sub



More tips from stackoverflow.com.


Comments