I’m trying to find a LINQ expression to compare two list elements.
What i want to do is:
List<int> _int = new List<int> { 1, 2, 3, 3, 4, 5};
_int.Where(x => x == _int[(_int.IndexOf(x)) + 1]);
Unfortunately, only the last +1 jumps out of the list’s range.
How can I compare one item with its next in the list in a LINQ expression?
Not that nice but should work.
Or the following.