C# Round to list values

Moh*_*med 2 .net c# rounding

I'm trying to round a result value to the next number in a list.

If the value is (187) I need to set the result to (240)

int[] list = new int[] { 16, 25, 35, 50, 70, 95, 120, 150, 185, 240, 300, 400 };
double max;
max = list.Where(x => x <= result).Max();
Run Code Online (Sandbox Code Playgroud)

But this does not work.

D S*_*ley 8

You're close:

list.Where(x => x >= result).Min();
Run Code Online (Sandbox Code Playgroud)