How I can select using Linq only entries from even positions in a list ?
You can use the overload to Enumerable.Where in which the predicate includes the item's index.
var myList = new List<int>{ 1, 2, 3, 4, 5, 6 };
var evenIndexes = myList.Where( (num, index) => index % 2 == 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With