Tim Van Wassenhove home

Quite often i’m writing code that compares one value against a range of other values. Most implementations compare the value against the boundaries (smallest and largest in the collection of other values). Having written this sort of code way too much i’ve decided to generalize the problem and distill an interface

public interface IRange<T>
	T Begin { get; set; }
	T End { get; set; }
	bool Includes(T t);
	bool Includes(IRange<T> range);
	bool Overlaps(IRange<T> range);

Offcourse, i’ve also written implementation. Feel free to download IRange.txt, Range.txt and RangeTester.txt