title: C#: Generic types that have a constructor?
body: <p>I have the following C# test code:</p>
  
  <pre><code>  class MyItem
    {
      MyItem( int a ) {}
    }
  
    class MyContainer&lt; T &gt;
      where T : MyItem, new()
    {
      public void CreateItem()
      {
        T oItem = new T( 10 );
      }
    }
  </code></pre>
  
  <p>Visual Studio can't compile it, the error is at line where 'new' is used:</p>
  
  <pre><code>'T': cannot provide arguments when creating an instance of a variable type
  </code></pre>
  
  <p>Is it possible in C# to create an object of generic type with non-parameterless constructor? It's no problem to do such thing in C++ templates, so i'm very curious why i can't do same thing in C#. Maybe some additional 'where' is required or syntax is different?</p>