title: Which to use ? IComparable generic or non-generic in this scenario
body: <p>I have a generic BST and a dataItem class to act as treeNode's value.</p>
  
  <pre><code>public class BinarySearchTree&lt;T&gt; : ICollection&lt;T&gt;  where T : IComparable
  {
  
  }
  
  public class EnglishDictionaryWord
      : IComparer&lt;EnglishDictionaryWord&gt;, IComparable&lt;EnglishDictionaryWord&gt;
  {
      public EnglishDictionaryWord(string word, WordCompareType type)
      {
          Word = word;
          Length = Word.Length;
          _compareType = type;
      }
  
      public int Compare(EnglishDictionaryWord x, EnglishDictionaryWord y)
      {
          if (_compareType == WordCompareType.Length)
              return new WordLengthComparer().Compare(x, y);
          else if (_compareType == WordCompareType.Lexical)
              return new WordLexicalComparer().Compare(x, y);
          else
              throw new InvalidOperationException("Unsupported Comparison type");
      }
  
      public int CompareTo(EnglishDictionaryWord obj)
      {
          return Compare(this, obj);
      }
  } 
  
  public class WordLengthComparer : IComparer&lt;EnglishDictionaryWord&gt;
  {
      public WordLengthComparer()
      {
  
      }
      public int Compare(EnglishDictionaryWord x, EnglishDictionaryWord y)
      {
          return x.Length - y.Length;
      }
  }
  
  and similar Lexical comparer class.
  </code></pre>
  
  <p>Now when i try to use:</p>
  
  <pre><code>BinarySearchTree&lt;EnglishDictionaryWord&gt; _tree = 
      new BinarySearchTree&lt;EnglishDictionaryWord&gt;();
  </code></pre>
  
  <p>I get compile error: </p>
  
  <p>The type 'DsLib.EnglishDictionaryWord' cannot be used as type parameter 'T' in the generic type or method 'DsLib.BinarySearchTree'. There is no implicit reference conversion from 'DsLib.EnglishDictionaryWord' to 'System.IComparable'.</p>
  
  <p>If I try to make </p>
  
  <pre><code>public class BinarySearchTree&lt;T&gt; : ICollection&lt;T&gt;  where T : IComparable&lt;T&gt;
  </code></pre>
  
  <p>then I get this compile error about boxing conversion unavailable.</p>
  
  <p>The type 'T' cannot be used as type parameter 'T' in the generic type or method 'DsLib.BinaryTreeNode'. There is no boxing conversion or type parameter conversion from 'T' to 'System.IComparable'.</p>
  
  <p>I have 2 questions:</p>
  
  <p>(1).
  <em>I am confused on the generics implementation. Can some one detail how to correct it ? and  general pattern to avoid such errors in future.
  When to use <code>IComparable&lt;T&gt;</code> and when <code>IComparable</code>.</em></p>
  
  <p>(2). Is this comparer pattern correct, having comparer inside the dataitem class? Because user will provide new <code>EnglishWord</code> to be inserted into tree. He can potentially be using different comparer for each word. Then it will break the Tree.</p>
  
  <p><strong>EDIT: Added BSTNode class code</strong></p>
  
  <pre><code>public class BinaryTreeNode&lt;T&gt; where T : IComparable
  {
      public BinaryTreeNode(T value)
      {
          Value = value;
      }
  
      public T Value { get; protected internal set; }
      public BinaryTreeNode&lt;T&gt; Right { get; protected internal set; }
      public BinaryTreeNode&lt;T&gt; Left { get; protected internal set; }
      public BinaryTreeNode&lt;T&gt; Parent { get; protected internal set; }
  
      public int Height { get; protected internal set; }
  }
  </code></pre>