title: How can I specifiy a generic collection as restriction in a generic method
body: <p>Aloha</p>
  
  <p>I have a method with (pseudo) signature:</p>
  
  <pre><code>public static T Parse&lt;T&gt;(string datadictionary) where T : List&lt;U&gt;
  </code></pre>
  
  <p>This doesn't build. How can I restrict the  in the method to accept only generic List&lt;> objects (which should of cource not contain T's but something else :)</p>
  
  <p>I need to restrict the type of T because I need to call a method on it in this code. The type passed in is a custom collection (based on List).</p>
  
  <pre><code>public class MyCollection&lt;T&gt; : List&lt;T&gt; where T: MyClass, new()
  {
      public void Foo();
  }
  
  
  public static T Parse&lt;T&gt;(string datadictionary) where T : MyCollection&lt;U&gt;
  {
      T.Foo();
  }
  </code></pre>
  
  <p>-Edoode</p>