As we all know, we cannot write such code in the current version of C #:
public class A {
public static void Method<T> () where T : new(string, string) {
var x = new T("foo", "bar");
}
}
but we can use new()constrain to ensure that Tit has an open constructor without parameters, and then we can create new instances Tusing an expression new T().
There are many answers to SO on various workarounds, but not one of them explains why language designers did not implement such a function. From the number of questions on SO, it looks like it would be useful in readable global applications.
Why this function was not implemented in C #, is there any chance that it will be added in the next version of the language?