4
I have a list that simulates a matrix (or two-dimensional array) that is structured as follows:
List<List<int>> matriz = new List<List<int>>();
Whereas this matriz
is initialized with the following values:
matriz.Add(new List<int> {3, 4, 1} );
matriz.Add(new List<int> {2, 4, 5} );
matriz.Add(new List<int> {44, 8, 9} );
And my problem is finding the position of line and of spine given a given value. For example, the value 44
is on the line 2
and column 0
, see:
matriz[2][0] // 44
I tried to use the method FindIndex
in this way:
matriz.FindIndex(x => x.Contains(44))
However, it only returns me a single value which is the position corresponding to the line which is 2
, and I would need the line and column position 2
and 0
.
Question
- How could I get the indexes corresponding to row and column
given a certain value of a list
List<List<int>>
?
What if you have other items with the same item? It will cause confusion on Linq.
– CypherPotato