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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -