I'll take it directly: For example I have an array
int[] integers = {1, 2, 2, 2, 4, 5, 2, 2, 2};
And all I like is to reduce all the stacks of 2 into only one 2. I need to get this at the end:
{1, 2, 4, 5, 2};
I read about the .Distinct() method and every kind of comparers, but that method deletes all the same elements and I don't want this. I still think there shold be some certain method to do it via Linq or somethig. Thanks!