fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. List<List<int>> matriz = new List<List<int>>();
  9. matriz.Add(new List<int> {3, 4, 1} );
  10. matriz.Add(new List<int> {2, 4, 5} );
  11. matriz.Add(new List<int> {44, 8, 9} );
  12.  
  13. int a = new int(),
  14. b = new int(),
  15. busca = 1;
  16. a = matriz.FindIndex(x => x.Contains(busca));
  17. matriz.ForEach(x => { if(x.Contains(busca)){ b = x.IndexOf(busca); } });
  18. Console.WriteLine("Busca: {0}, Linha: {1}, Coluna: {2}", busca, a, b);
  19. }
  20. }
Success #stdin #stdout 0.03s 15196KB
stdin
Standard input is empty
stdout
Busca: 1, Linha: 0, Coluna: 2