I would like to dynamically create an object, using a non-public
constructor and without ReflectionPermi ssion.
At the place where I want to do this, I could access the internal
constructor non-dynamically (because it's the same assembly), so
theoretically, I should have enough rights to do this with reflection
also...
But if I use:
st = (StructureType)
Activator.Creat eInstance(typeL ookup[objectname]
, BindingFlags.In stance | BindingFlags.No nPublic
, null
, new object[] {objectparams, objectcomment, str}
, null);
I will have to have ReflectionPermi ssion, because the constructor is
internal, and thus I'm using BindingFlags.No nPublic. Is there a way to
dynamicaly invoke an internal constructor without
ReflectionPermi ssion?
Of course, making the internal constructor public is not an option and
it must remain dynamic, thus instantiating based on the textstring
containing the classname.
Best regards,
Edwin.
constructor and without ReflectionPermi ssion.
At the place where I want to do this, I could access the internal
constructor non-dynamically (because it's the same assembly), so
theoretically, I should have enough rights to do this with reflection
also...
But if I use:
st = (StructureType)
Activator.Creat eInstance(typeL ookup[objectname]
, BindingFlags.In stance | BindingFlags.No nPublic
, null
, new object[] {objectparams, objectcomment, str}
, null);
I will have to have ReflectionPermi ssion, because the constructor is
internal, and thus I'm using BindingFlags.No nPublic. Is there a way to
dynamicaly invoke an internal constructor without
ReflectionPermi ssion?
Of course, making the internal constructor public is not an option and
it must remain dynamic, thus instantiating based on the textstring
containing the classname.
Best regards,
Edwin.
Comment