Just list the indexes and select the index with the smallest delta, as if you were doing a regular loop.
const int value = 9; var list = new List<int> { 2, 5, 7, 10 }; var minIndex = Enumerable.Range(1, list.Count - 1) .Aggregate(0, (seed, index) => Math.Abs(list[index] - value) < Math.Abs(list[seed] - value) ? index : seed);
source share