c# - Create Instance using base constructor -
for reasons out of scope of question, i'm needing dynamically create instance of child class inherits base class, calling constructor doesn't exist argument passed base class constructor
using example below: should create instance of exampleclass
sending value argument1
of baseclass
.
class baseclass { public baseclass() { } public baseclass(string argument1) { //... } } class exampleclass : baseclass { public exampleclass() { } }
edit: made topic explain source or problem: entity framework dbcontext dynamic instatiation custom connection string
if understand correct can't modify exampleclass need create instance of uses different constructor base class?
i belive there not build in way in framework achive it, reflection. goal should bypass framework , use msil
however, topic found on looks promissing.
Comments
Post a Comment