To simplify the scenario, let's say we have a list of People with FirstName and LastName properties.
Our data looks like this:
Bob Smith
Jane Smith
Todd Grover
Larry Lewis
Jill Lewis
Frank Lewis
The first step would be to add an Integer property that gets incremented for each item:
Bob Smith 1
Jane Smith 2
Todd Grover 3
Larry Lewis 4
Jill Lewis 5
Frank Lewis 6
Ideally, I'd like to reset the counter for every new group to achieve this:
Bob Smith 1
Jane Smith 2
Todd Grover 1
Larry Lewis 1
Jill Lewis 2
Frank Lewis 3
Maybe LINQ isn't appropriate. It just seems like LINQ should be able to do this elegantly.