Is there any way to cast a class from an external (managed) assembly to a specific interface?
I mean instead of calling MethodInfo.Invoke(instance, parameters);
, do something like this
Assembly assembly = Assembly.LoadFrom(assemblyName);
System.Type type = assembly.GetType(typeName);
Object o = Activator.CreateInstance(type);
IYourType yourObj = (o as IYourType);
Aucun commentaire:
Enregistrer un commentaire