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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -