Is there a generic constructor with parameter constraint in C#? -
You can put an obstacle on a common method like:
public Class A {public static zero method & lt; T & gt; (TA) where T: new () {// ... some ...}}
Where do you specify that a constructor of T
There should be no criteria for this. I am thinking that there is a constructor with " a float [,]
parameter such as" There is a way to add a restriction "
The following code is not compiled:
public class A {public static zero method
(tA) where T: new (float) [,] U) {// ... some ...}}
As you've found, you do not have to
As a normal functioning, a representative who can create types of objects
T
:public class A {Public static zero method
(TA, Funk & Ltfinum; float [,], T & gt; creator) {// ... some ...} >
Comments
Post a Comment