As I mentioned in my comment, you can do this easily with an array. Please note that the array must be sorted in ascending order.
double[] numbers = new[] {0.25,0.50,0.75,1,1.25,2,2.5,3.5};
int index = Array.BinarySearch(numbers, 0.3);
if(index >= 0)
{
Console.WriteLine("is exact match");
}
else
{
int lowerBound = -index-2;
int upperBound = -index-1;
if(lowerBound < 0)
Console.WriteLine("is minimum");
else if(upperBound >= numbers.Length)
Console.WriteLine("is maximum");
else
Console.WriteLine("is between {0} and {1}", numbers[lowerBound], numbers[upperBound]);
}
Please see MSDN for more details on
Array.BinarySearch[
^] method.