c# - How can I call the constructor? -
i dynamically create instances of objects in custom linq provider building using call:
object result = activator.createinstance(typeof(t));
my t type implements abstract class has constructor take instance of object (t wrapper). question - there way can explicitly call non-default constructor can rid of this:
myentity entity = result myentity; if(entity != null) entity.underlyingentity = e; //where e wrapping
yes, supply constructor arguments after type
object, so:
object result = activator.createinstance(typeof(t), arg1, arg2, ...);
Comments
Post a Comment