Suppose I have this number list:
List = new List(){3,5,8,11,12,13,14,21}
Suppose that I want to get the closest number th
You can use a query for this such as:
List numbers = new List() { 3, 5, 8, 11, 12, 13, 14, 21 }; List output = (from n in numbers where n > 13 // or whatever orderby n ascending //or descending select n).ToList();