title: C# - No implicit reference conversion from 'T' to 'System.IComparable<T>'
body: <p>I have taken the following class from another SO question:</p>
  
  <pre><code>    public class Range&lt;T&gt; where T : IComparable&lt;T&gt;
      {
          public T Minimum { get; set; }
          public T Maximum { get; set; }
  
          public override string ToString() { return String.Format("[{0} - {1}]", Minimum, Maximum); }
  
          public Boolean IsValid() { return Minimum.CompareTo(Maximum) &lt;= 0; }
  
          public Boolean ContainsValue(T value)
          {
              return (Minimum.CompareTo(value) &lt;= 0) &amp;&amp; (value.CompareTo(Maximum) &lt;= 0);
          }
      }
  </code></pre>
  
  <p>I would like, however, to create another class that contains many instances of this class, and can execute a foreach loop on them all, returning true if the number passed is contained in any one of the ranges:</p>
  
  <pre><code>    public class Ranges&lt;T&gt; where T : Range&lt;T&gt;
      {
          private List&lt;Range&lt;T&gt;&gt; rangelist;
  
          public void add(Range&lt;T&gt; range)
          {
              rangelist.Add(range);
          }
  
          public Boolean ContainsValue(T value)
          {
              foreach (Range&lt;T&gt; range in rangelist)
              {
                  if (range.ContainsValue(value)) return true;
              }
  
              return false;
          }
      }
  </code></pre>
  
  <p>However, i am getting the error <code>The type 'T' cannot be used as type parameter 'T' in the generic type or method 'Range&lt;T&gt;'. There is no implicit reference conversion from 'T' to 'System.IComparable&lt;T&gt;'.</code></p>
  
  <p>What exactly is going wrong here?</p>