Get the next number in a list of numbers using LINQ

c#, linq, list

Solution

You can use the following:

double result = mylist.SkipWhile(n => n != 8).Skip(1).First();

Problem

I have a list of numbers as below: ``` var mylist = new List<double> {1, 5, 8, 10, 12}; ``` How can I get the number after a specific number. I want an `LINQ` expression that receives for example `8` and gives me `10`;

Original source