using static System.Console; using System.Collections.Generic; using System.Linq; public class Program { public static void Main() { var lista = new List<string> { "1,Joao", "2,Maria", "3,José1" }; var nome = lista.Select(x => x.Split(',')).SingleOrDefault(a => a[1].Contains("1")); var id = lista.Select(x => x.Split(',')).SingleOrDefault(a => a[0].Contains("1")); WriteLine(nome[1]); WriteLine(id[1]); } } //https://pt.stackoverflow.com/q/345563/101
Standard input is empty
Standard output is empty
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