using System.Collections.Generic;
public int Id {get; set;}
public string Nome {get; set;}
public char Sexo {get; set;}
public static void Main()
List<Pessoa> pessoas = ObterListaPessoas();
var pessoa4 = ConsultaPessoa(pessoas, 4);
Console.WriteLine(pessoa4.Nome);
public static List<Pessoa> ObterListaPessoas(){
List<Pessoa> lista = new List<Pessoa>();
lista.Add(new Pessoa{ Id = 1, Nome = "Jeudi", Sexo = 'M'});
lista.Add(new Pessoa{ Id = 2, Nome = "Prando", Sexo = 'M'});
lista.Add(new Pessoa{ Id = 3, Nome = "Araujo", Sexo = 'M'});
lista.Add(new Pessoa{ Id = 4, Nome = "Bruno", Sexo = 'M'});
public static Pessoa ConsultaPessoa(List<Pessoa> pessoas, int id){
return pessoas.FirstOrDefault( p => p.Id == id);