title: Difference between interface inheritance and generic constraints
body: <p>I have the <strong>following code in C#</strong>:</p>
  
  <p>1)</p>
  
  <pre><code>public class MyBinaryTree&lt;TItem&gt; where TItem : IComparable&lt;TItem&gt;
  { ... };
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>public class MyBinaryTree&lt;TItem&gt; : IComparable&lt;TItem&gt;
  { ... };
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/1308002/comparision-problem-in-c-sharp">I found this sample at this site</a>, but it is not <em>entirely the way</em> I want.</p>
  
  <p>The first example/code tells us that <strong>item (TItem) implements the interface IComparable</strong>.</p>
  
  <p>The second example/code tells us that our whole <strong>class (MyBinaryTree) implements the interface IComparable</strong>.</p>
  
  <p>I do not understand it very well.
  The first example I've never used and the second I use often (this is a classic example of the interface). Some advice - supplements?</p>
  
  <p>How does it <strong>apply in practice</strong>?</p>