There is an error in your code: Where expects a delegate that returns a bool value and has a list item type as input.
var result = list .Select((p, index) => index)
So you will need Func<int,bool>
However, from your specification, I think you want Func<T,int,bool> , which means that you need to rewrite your implementation of GetIndices as
var result = list .Select((p, index) => new {p, index}) .Where(x => condition(xp, x.index)) .Select(x => x.index);
source share