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.
My code:
public class GenericClass<T> where T : Some_Base_Class, new()
{
public static T SomeFunction(string s)
{
if (String.IsNullOrEmpty(s))
return new T(some_param);
}
}
I get an error on the
new T(some_param)
'T': cannot provide arguments when creating an instance of a variable type
Any ideas how can I do this?