public class A { public A(Control control) { //... } } public class B : A { public B(Control control) :base(control) { //... } } public class C : A { public C(Control control) :base(control) { //... } } public static class Factory { public static T Instantiate<T>(Control control) where T : A, new() { return new T(control); // Тут ошибка } } 'T' cannot provide arguments when variable of a variable type
Through Ativator, they say, 11 times slower than through new T () Is there any way to pass the parameter to the universal constructor?
Activator.CreateInstance. According to your words, you do not want to use it, because it "is said to be 11 times slower." This means that you are trying to optimize. At least, it seemed to me from your words. - VladD