title: Odd behaviour with generic Constraints on an Extension method
body: <p>I must be doing something wrong here (because really, what are the chances of me tripping over another <a href="https://stackoverflow.com/questions/700916/vb-unreachable-code-error-warning">bug in the Vb.net compiler</a>?)</p>
  
  <p>I have a static generic function in .net 2.0 Vb code, I thought it was time to "upgrade" it to be an extension method, but the compiler complains with </p>
  
  <blockquote>
    <p>Extension method 'AddIfUnqiue' has
    type constraints that can never be
    satisfied.</p>
  </blockquote>
  
  <p>Here's a trivial example that displays the same problem. The old static version (which works fine) followed by the extension method</p>
  
  <pre><code>Public Class MyStaticClass
      Public Shared Sub AddIfUnqiue(Of T, L As {List(Of T)})(ByVal this As L, ByVal item As T)
          If this.IndexOf(item) &lt; 0 Then
              this.Add(item)
          End If
      End Sub
  End Class
  
  Module UtilityExtensions
      &lt;Extension()&gt; _
      Sub AddIfUnqiue(Of T, L As {List(Of T)})(ByVal this As L, ByVal item As T)
      'ERROR: Extension method 'AddIfUnqiue' has type constraints that can never be satisfied'
          If this.IndexOf(item) &lt; 0 Then
              this.Add(item)
          End If
      End Sub 
  End Module
  </code></pre>
  
  <p>The equivalent code in C# has no problem, it's just a Vb issue.</p>
  
  <pre><code>public static void AddIfUnique&lt;T, L&gt;(this L myList, T item) where L : List&lt;T&gt;
  {
      if (myList.IndexOf(item) &lt; 0)
          myList.Add(item);
  }
  </code></pre>
  
  <p>Has anyone any idea why this doesn't work?
  It could well be my Vb constraints (I'm more comfortable with c#), but I can't see what I've done wrong.</p>
  
  <p>Thanks,</p>