Let's say I have the following code.
var numberToGetTo = 60;
var list = new[] {10, 20, 30, 40, 50};
I want to be able to return 50 and 10 from a list in = 60.
If the ToGetTo number was 100, I would like to return 50, 50.
If the ToGetTo number was 85, I would like to return 50, 40.
I want to return the smallest number of numbers from the list needed to access "numberToGetTo", while remaining closest (equal to or greater) than to it.
Does something like this possible with Linq?
source
share