static void Main(string[] args)
 {
     // Example 1:
     // 1st range is defined as continous range from 5 to 11 and 2nd is periodical sequence from 2 to 18 with step 2 (thus, 8 steps).
     // Intersection will return a periodic sequence from 6 to 10 with step 2.example 1
     ContinuousRange   ex1_r1                   = new ContinuousRange(5, 11);
     PeriodicRange     ex1_r2                   = new PeriodicRange(2, 2, 8);
     IEnumerable <int> ex1_intersection         = ex1_r1.Values.Intersect(ex1_r2.Values);
     IList <Range>     ex1_intersection_results = Range.ConstructAppropriate(ex1_intersection);
 }
    public static IList <Range> ConstructAppropriate(IEnumerable <int> values)
    {
        var results = new List <Range>();

        results.Add(ContinuousRange.ConstructFrom(values));
        results.Add(PeriodicRange.ConstructFrom(values));
        if (!results.Any(r => r != null))
        {
            results.Add(Points.ConstructFrom(values));
        }
        return(results.Where(r => r != null).ToList());
    }