Lets say I have an enumerable source, that looks like this:
IEnumerable<string> source = new [] { "first", "first", "first", "second" };
I want to be able to construct a LINQ statement that will return this:
"first", "first", "second"
Notice how only one of the firsts is gone. I don’t care which one, because in my case all 3 “first”s are considered equal. I’ve tried source.Except(new [] { "first" }) but that strips all instances out.
For each group, skip the first element of the group and return the rest – unless that would return none… in that case, return the first element of the group.
For each group, take the first element, and take from the third element on – always skipping the second element.