-
Notifications
You must be signed in to change notification settings - Fork 0
Range
Artem Kirgizov edited this page May 31, 2021
·
3 revisions
Namespace: Toolkit
Range - a class that defines the framework between two values, and allows you to define other values for belonging to a given interval. It can be useful when comparing time intervals, or for checking membership in a number range.
The main features of the class:
var interval = new Range<int>(1, 10);
bool result;
result = interval.Inside(-1); // false
result = interval.Inside(5); // true
result = interval.Between(1); // false
result = interval.Between(5); // true
result = interval.Outside(10); // false
result = interval.Outside(12); // true
result = interval.Beyond(10); // false
result = interval.Beyond(11); // true
result = interval.Before(1); // false
result = interval.Before(-1); // true
var secondInterval = new Range<int>(1, 10);
if (interval != secondInterval) // false
if (interval == secondInterval) // true