Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created May 11, 2021 16:38
Show Gist options
  • Save luisdeol/79893c2b179a22a5a8593b7361f66407 to your computer and use it in GitHub Desktop.
Save luisdeol/79893c2b179a22a5a8593b7361f66407 to your computer and use it in GitHub Desktop.
Artigo LINQ #2: Select
using System;
using System.Collections.Generic;
using System.Linq;
namespace ArtigoLinq
{
class Program
{
static void Main(string[] args)
{
var pessoas = new List<Pessoa>
{
new Pessoa("Luis", "Dev", "123.456.789-10", "Rua Numero 1", "00000-000", "123a", "São Paulo/SP"),
new Pessoa("Rafael", "Dev", "321.654.987-99", "Rua Numero 1", "00000-000", "123b", "São Paulo/SP"),
new Pessoa("Nicholas", "Dev", "789.456.123-65", "Rua Numero 1", "00000-000", "123c", "São Paulo/SP")
};
var pessoasViewModel = pessoas
.Select(p => new PessoaItemViewModel(
$"{p.Nome} {p.Sobrenome}",
p.Documento
))
.ToList();
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment