How can I do this elegantly with C# and .NET 3.5/4?
For example, a number can be between 1 and 100.
I know a simple if would suffice; but the keyword to this
A new twist on an old favorite:
public bool IsWithinRange(int number, int topOfRange, int bottomOfRange, bool includeBoundaries) { if (includeBoundaries) return number <= topOfRange && number >= bottomOfRange; return number < topOfRange && number > bottomOfRange; }