Linq grouping question
- by Mike C.
I have the following objects in a collection:
Transaction:
Type = "Widget"
Date = "3/1/2011"
Name = "Foo"
Transaction:
Type = "Widget"
Date = "3/4/2011"
Name = "Bar"
Transaction:
Type = "Gadget"
Date = "3/2/2011"
Name = "Baz"
Transaction:
Type = "Gizmo"
Date = "3/1/2011"
Name = "Who"
Transaction:
Type = "Gizmo"
Date = "3/2/2011"
Name = "What"
Transaction:
Type = "Gizmo"
Date = "3/6/2011"
Name = "When"
I want to end up with the following, grouped by Type. If there are multiple, return only the first one chronologically by date.
Transaction:
Type = "Widget"
Date = "3/1/2011"
Name = "Foo"
Transaction:
Type = "Gadget"
Date = "3/2/2011"
Name = "Baz"
Transaction:
Type = "Gizmo"
Date = "3/1/2011"
Name = "Who"