-
Notifications
You must be signed in to change notification settings - Fork 0
IComparable extension methods
Alex Kamsteeg edited this page Aug 8, 2015
·
1 revision
SwissArmyKnife adds the following extension methods to IComparable<T>:
The IsBetween() extension method makes it easier to determine whether a value falls within a range or not. Without it you have to write the following code:
var example = 2;
if (example >= 1 && example <= 3)
{
// do something
}IsAnyOf() shortens this to:
var example = 2;
if (example.IsBetween(1,3))
{
// do something
}