Is there a better way to do this?
string[] s = {'zero', 'one', 'two', 'three', 'four', 'five'}; var x = s .Select((a,i) => new {Value = a, Index = i}) .Where(b => b.Value.StartsWith('t')) .Select(c => c.Index);
i.e. I’m looking for a more efficient or more elegant way to get the positions of the items matching the criteria.
You could easily add your own extension method:
Then use it with: