Program.cs
using (HttpClient client = new HttpClient())
try
{
string resposta = await client.GetStringAsync("https://raw.githubusercontent.com/ArthurOcFernandes/Exerc-cios-C-/curso-4-aula-2/Jsons/Livros.json");
var livro = JsonSerializer.Deserialize<List<Livros>>(resposta)!;
//livro[0].ExibirDetalhes();
LinqFilter.FiltroDeLancamento(livro);
} catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
LinqFilter.cs
internal class LinqFilter
{
public static void FiltroDeLancamento(List<Livros> livros)
{
var lancamentoDoLivro = livros.Where(l => l.Ano > 1950).Select(l => l.Nome).ToList();
foreach(var livro in lancamentoDoLivro)
{
Console.WriteLine($"{livro}");
}
}
}