I\'m looking for a fluent way of determining if a number falls within a specified set of ranges. My current code looks something like this:
int x = 500; // Could
LINQ approach :
Add the reference:
using System.Linq;
///
/// Test to see if value is in specified range.
///
/// int
/// int
/// int
/// bool
public static bool CheckValueInRange(int aStart, int aEnd, int aValueToTest)
{
// check value in range...
bool ValueInRange = Enumerable.Range(aStart, aEnd).Contains(aValueToTest);
// return value...
return ValueInRange;
}