fork download
  1. using static System.Console;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. var lista = new List<string> { "1,Joao",
  8. "2,Maria",
  9. "3,José1" };
  10. var nome = lista.Select(x => x.Split(',')).SingleOrDefault(a => a[1].Contains("1"));
  11. var id = lista.Select(x => x.Split(',')).SingleOrDefault(a => a[0].Contains("1"));
  12. WriteLine(nome[1]);
  13. WriteLine(id[1]);
  14. }
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/345563/101
Runtime error #stdin #stdout #stderr 0s 6332KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:7: syntax error, unexpected tCONSTANT, expecting keyword_do or '{' or '('
		var lista = new List<string> { "1,Joao",
		                ^~~~
prog.rb:7: syntax error, unexpected ',', expecting =>
... = new List<string> { "1,Joao",
...                              ^
prog.rb:8: syntax error, unexpected ',', expecting '}'
			"2,Maria",
			         ^
prog.rb:9: syntax error, unexpected ';', expecting &. or :: or '[' or '.'
			"3,José1" };
			            ^
prog.rb:14: syntax error, unexpected '}', expecting end-of-input