I have a list of objects like this:
List list = new List(); list.Add(new ClassName() { Name = 1, Amount = 5 }); list.Ad
var result = list.GroupBy(x => x.Name).Select(x => new MyClass() {Name=x.Key, Amount= x.Sum(y => y.Amount));
OR
List result = list.GroupBy(x => x.Name).Select(x => new MyClass() {Name=x.Key, Amount= x.Sum(y => y.Amount)).ToList();