title: .NET Add constrained Generic type to List
body: <p>I have constrained generic method and generic list of specified type. Is it somehow possible to add this constrained item to the list?</p>
  
  <pre><code>class Test
  { 
      private static Test _instance;
      private List&lt;QueueItem&lt;IData&gt;&gt; queue;
  
      public static void Enqueue&lt;T&gt;(QueueItem&lt;T&gt; i) where T : IData, new()
      {
          _instance.queue.Add(i); //Fails on compilation
      }
      //...some other code...
  }
  </code></pre>
  
  <p>The other classes are:</p>
  
  <pre><code>public class IData
  {
      public IData() { }
  }
  
  class QueueItem&lt;T&gt; where T : IData, new()
  {
      public SomeUnchangableClass&lt;T&gt; Data {get; set;}
      public string Description { get; set; }
  }
  </code></pre>
  
  <p>I have to keep constraint <strong>IData, new()</strong> because the rest of the code. But I don't know why I am not able to add this item to the generic list since constraint is on the same class. </p>