E
Edwin
I would like to dynamically create an object, using a non-public
constructor and without ReflectionPermission.
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.CreateInstance(typeLookup[objectname]
, BindingFlags.Instance | BindingFlags.NonPublic
, null
, new object[] {objectparams, objectcomment, str}
, null);
I will have to have ReflectionPermission, because the constructor is
internal, and thus I'm using BindingFlags.NonPublic. Is there a way to
dynamicaly invoke an internal constructor without
ReflectionPermission?
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 ReflectionPermission.
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.CreateInstance(typeLookup[objectname]
, BindingFlags.Instance | BindingFlags.NonPublic
, null
, new object[] {objectparams, objectcomment, str}
, null);
I will have to have ReflectionPermission, because the constructor is
internal, and thus I'm using BindingFlags.NonPublic. Is there a way to
dynamicaly invoke an internal constructor without
ReflectionPermission?
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.