Lets say this is my list {1, 2, 3, 4, 5, 6, 7, 8, 9 }
Now I would like to mix the items to following list: { 1, 9, 2, 8, 3, 7, ..}
Basically always one item from left side and one item from right side of the list.
Is there a possibilities to create this just by using linq statement?
Yes, you can do this using just LINQ (reasonably briefly, even), but it's not exactly pleasant:
So:
var query = original.Zip(original.Reverse(), (x, y) => new[] { x, y })
.SelectMany(x => x)
.Take(original.Count());
If I were actually going to use this code, I'd definitely put a comment in there...
See more on this question at Stackoverflow