I have a generic method that takes in a type T, which i need to be able to call a constructor on that requires a single XmlNode. Currently, I am trying to do that by having an abstract base class that has the constructors I want (plus a parameterless one so i don't have to edit the "subclasses" other than to add the actual subclassing) and constraining by that. If i try to instantiate one of these classes, it complains that it:
Cannot create an instance of the variable type 'T' because it does not have the new() constraint
and if i add the new()
constraint, i get:
'T': cannot provide arguments when creating an instance of a variable type
How can i do what I want?