You can use Any()
with any condition you like. Your condition would be as simple as "bigger than the key, but smaller than the value or the other way round". So the expression/code can look like this:
IDictionary<double, double> values = new Dictionary<double, double>();
values.Add(1.1, 2.2);
values.Add(3.3, 4.4);
values.Add(5.5, 5.0);
double check = 1.5;
bool found = values.Any(it => (it.Key <= check && check <= it.Value) ||
(it.Value <= check && check <= it.Key));
Console.WriteLine(found);
This will print True
as the value check
of 1.5
is between 1.1
and 2.2
.