title: C# generic methods, type parameters in new() constructor constraint
body: <p>Is there a way to create a Generic Method that uses the <code>new()</code> constraint to require classes with constructor attributes of specific types?</p>
  <p><strong>For Example:</strong></p>
  <p>I have the following code:</p>
  <pre><code>public T MyGenericMethod&lt;T&gt;(MyClass c) where T : class
  {
      if (typeof(T).GetConstructor(new Type[] { typeof(MyClass) }) == null)
      {
          throw new ArgumentException(&quot;Invalid class supplied&quot;);
      }
      // ...
  }
  </code></pre>
  <p>Is it possible to have something like this instead?</p>
  <pre><code>public T MyGenericMethod&lt;T&gt;(MyClass c) where T : new(MyClass)
  {
      // ...
  }
  </code></pre>
  <hr />
  <p><strong>EDIT:</strong> There's <a href="http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2122427-expand-generic-constraints-for-constructors" rel="nofollow noreferrer">a suggestion</a> regarding this. Please vote so we can have this feature in C#!</p>
  <p><strong>EDIT 2:</strong> The site has been taken down. Now the suggestion is on <a href="https://github.com/dotnet/csharplang/discussions/769" rel="nofollow noreferrer">Github</a>. Follow up there!</p>