G
gilbert@gmail
Hello.
I am trying to use c# generic to define a class.
class MyClass<T> where T: new(){
}
In this definition, MyClass can create T objects with a default
constructor. Is there any way to set the constraint such that MyClass
can create T objects with some custom constructors (provided that T
has such a cstr)?
Thank you very much!
Gilbert
I am trying to use c# generic to define a class.
class MyClass<T> where T: new(){
}
In this definition, MyClass can create T objects with a default
constructor. Is there any way to set the constraint such that MyClass
can create T objects with some custom constructors (provided that T
has such a cstr)?
Thank you very much!
Gilbert