I have an array of doubles and a threshold value.
I would like to select the first index in my array where the value at the index is larger than the threshold.
How the do I accomplish that in LINQ?
I got it to work with:
var n = acc_avg.Select((val, index) => new {Val = val, Index = index})
.Where(l => l.Val > threshold)
.First()
.Index
But is there is better way?
You can use
Array.FindIndex: