Suppose I have this number list:

List<int> = new List<int>(){3,5,8,11,12,13,14,21}

Suppose that I want to get the closest number that is less than 11, it would be 8 Suppose that I want to get the closest number that is greater than 13 that would be 14.

The numbers in list can't be duplicated and are always ordered. How can I write Linq for this?

Edit
Report