using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic;
public static void Main()
var fooList = new List<Foo> {
new Foo { SomeDate = DateTime.Now.AddMonths(0), SomeValue = 1 },
new Foo { SomeDate = DateTime.Now.AddMonths(0), SomeValue = 2 },
new Foo { SomeDate = DateTime.Now.AddMonths(6), SomeValue = 3 },
new Foo { SomeDate = DateTime.Now.AddMonths(6), SomeValue = 4 },
new Foo { SomeDate = DateTime.Now.AddMonths(12), SomeValue = 5 },
new Foo { SomeDate = DateTime.Now.AddMonths(12), SomeValue = 6 },
new Foo { SomeDate = DateTime.Now.AddMonths(14), SomeValue = 7 },
new Foo { SomeDate = DateTime.Now.AddMonths(14), SomeValue = 8 }
var results = fooList.GroupBy(g=> new { g.SomeDate.Year })
TheContent = s.GroupBy(x=>x.SomeDate.Month)
TheSum = m.Sum(e=>e.SomeValue)
foreach(var result in results)
foreach(var content in result.TheContent)
Console.WriteLine("{0} - {1}", result.Year, content);
public DateTime SomeDate { get; set; }
public int SomeValue { get; set; }