using System.Collections.Generic;
public string Nome { get; set; }
public DateTime Nascimento { get; set; }
public override string ToString()
return "(" + Nome + " , " + Nascimento.ToString("dd/MM/yyyy") + ")";
public class TreinoFocadoB
public List<Pessoa> FiltrarMaiores18(List<Pessoa> pessoas)
List<Pessoa> filtrados = new List<Pessoa>();
for (int i = 0; i < pessoas.Count; i++)
if (p.Nascimento <= DateTime.Now.AddYears(-18))
TreinoFocadoB treinoB = new TreinoFocadoB();
List<Pessoa> pessoas = new List<Pessoa>()
new Pessoa() { Nome = "Saulo", Nascimento = new DateTime(2005, 04, 22) },
new Pessoa() { Nome = "Amanda", Nascimento = new DateTime(2002,05,16) },
new Pessoa() { Nome = "Matheus", Nascimento = new DateTime(2002,04,22) }
List<Pessoa> x1 = treinoB.FiltrarMaiores18(pessoas);
Console.WriteLine(string.Join(" - ", x1));