As soon as I understand you, do you want to add the list based on the id?
public class Articulo
{
public Int32 IdArticulo { get; set; }
public decimal Cantidad { get; set; }
public string Estado { get; set; }
public int IdGrupo { get; set; }
}
var lstArticulos = ConsultaTodosArticulosDesdeBD();
var LstGrupoSumado = lstArticulos.GroupBy(l => l.IdGrupo)
.Select(la =>
new {
IdGrupo = la.Key,
NoArticulos= la.Count(),
SumaCantidad = la.Sum(s => s.Cantidad),
}).toList();
This is the way to work with lambda expressions.
First they are grouped with GroupBy () , in this case by their Id.
After Select () will assign each of its values. If you notice, this GroupBy keeps the data as List being within the Select. And answering your question, the sum is done with the function Sum ()