If you want to create your own instance of T, you need to define a new() constraint
class Data<T> where T: new() { T obj; public Data() { obj = new T(); } }
If you want to pass an obj object, you need to enable it in the constructor
class Data<T> { T obj; public Data(T val) { obj = val; } }
Stan R.
source share