This question already has an answer here:
I have some code like this
class outer : Plugin
{
private class inner
{
//
}
}
//somewhere out of my control
foreach(var a in _plugins)
{
foreach(var t in a.GetTypes())
{
if(!t.IsClass || t.IsAbstract) continue;
if(!typeof(T).IsAssignableFrom(t)) continue;
T i;
try {i=(T)Activator.CreateInstance(t, constructorArgs);}
//..
In this scenario the activator creates an instance of my internal class inner. Is there a way to prohibit that, by 'hiding' the inner class somehow?
Aucun commentaire:
Enregistrer un commentaire