Skip to content

Instantly share code, notes, and snippets.

@jfbueno
Last active July 18, 2019 19:54
Show Gist options
  • Save jfbueno/75a650b6a1ab1588f5f4fdb0ad6e0f63 to your computer and use it in GitHub Desktop.
Save jfbueno/75a650b6a1ab1588f5f4fdb0ad6e0f63 to your computer and use it in GitHub Desktop.
// Apenas clientes com mais de uma compra
var aggComFiltro = grupos.Where(gp => gp.Count() > 1).Select(gp => new
{
Cliente = gp.Key,
PiorCompra = gp.Where(c => c.Valor > 150).Min(x => x.Valor)
// Apenas compras acima de 150
});
foreach(var elemento in aggComFiltro)
{
WriteLine($"Cliente: {elemento.Cliente}");
WriteLine($"Pior compra (acima de 150): {elemento.PiorCompra}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment