title: Generics in C# - how can I create an instance of a variable type with an argument?
body: <p>I've got a generics class, where I want to instantiate an object with the generic type. I want to use an argument for the constructor of the type.</p>
  
  <p>My code:</p>
  
  <pre><code>public class GenericClass&lt;T&gt; where T : Some_Base_Class, new()
  {
      public static T SomeFunction(string s)
      {
          if (String.IsNullOrEmpty(s))
              return new T(some_param);
      }
  }
  </code></pre>
  
  <p>I get an error on the</p>
  
  <pre><code>new T(some_param)
  </code></pre>
  
  <blockquote>
    <p><em>'T': cannot provide arguments when creating an instance of a variable
    type</em></p>
  </blockquote>
  
  <p>Any ideas how can I do this?</p>