Generics question 2
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, how to make the generic type has specific constructor? what should I add on the class definition if I don't want to add get/set function to set that value for some reason? e.g. public class ClassA<T> { public T Create() { List list = outside.list(); T t = new T(list); } } // how to let T is only has a T(List list)? I have thing about Interface and Abstract class but those cannot work. And if I tried to use another class to input the value, it's too specific. any solution? Thanks.