c# - Generic method: instantiate a generic type with an argument -
this question has answer here:
i have generic method takes in type t, need able call constructor on requires single xmlnode. currently, trying having abstract base class has constructors want (plus parameterless 1 don't have edit "subclasses" other add actual subclassing) , constraining that. if try instantiate 1 of these classes, complains it:
cannot create instance of variable type 't' because not have new() constraint
and if add new()
constraint, get:
't': cannot provide arguments when creating instance of variable type
how can want?
c# lawyer: how create instance of generic type parameters
c# generics problem - newing generic type parameters in constructor
Comments
Post a Comment