Efficient Logic to get distinct values from a range of values in c# 2.0
<p>I have  a list of ranges. Each range has a from and to value, meaning the value can be between that range. For eample if range is (1,4)., the values can be 1,2,3 and 4. Now, I need to find the distinct values in a given list of range. Below is the sample code.</p>

<pre><code>class Program
{
    static void Main(string[] args)
    {
        List&lt;Range&gt; values = new List&lt;Range&gt;();
        values.Add(new Range(1, 2));
        values.Add(new Range(1, 3));
        values.Add(new Range(1, 4));
        values.Add(new Range(3, 5));
        values.Add(new Range(7, 10));
        values.Add(new Range(7, 8));

        // Expected Output from the range of values
        //1,2,3,4,5,7,8,9,10
    }
}
class Range
{
    public Range(int _form, int _to)
    {
        from = _from;
        to = _to;
    }
    private int from;

    public int From
    {
        get { return from; }
        set { from = value; }
    }

    private int to;

    public int To
    {
        get { return to; }
        set { to = value; }
    }

}
</code></pre>

<p>I can loop through every range and find the distinct values. but if some one can give an effieient approach, it would be helpful.</p>
