I want to know if there is an already made data type for ranges. It'll must have capability more than just representing a range of numbers, but also to have a value to a range and to be able to intersect ranges, to explain better I'll show what I'm expecting with C# code as if there was this kind of data type.
RangeCollection rc = new RangeCollection();
//rc.Add(new Range(from, to, value));
rc.Add(new Range(1, 4, 1));
rc.Add(new Range(3, 6, 2));
Console.WriteLine(rc[1]); // output is: 1
Console.WriteLine(rc[4]); //output is: [1,2]
I know I can do it myself, but I want to know if there is something already existing which is similar or partially like this. Thanks!