casting objects from reflection

  • Thread starter Thread starter Gerald Zukrigl
  • Start date Start date
G

Gerald Zukrigl

I'm trying to implement a plug-in system. So I've implemented an abstract
baseclass pluginbase and a nonabstract class named pluginimplementation.
Then I've opened the assembly containing both classes with LoadFrom. When
I'm trying to cast an instance of the pluginimplementation class (which I've
retrieved by the reflection) to a pluginbase reference null is returned. Is
there a way of getting an instance, which can be used like a usual instance,
this means without calling Invoke for every methodcall? Are there any
samples?

Thank you,

Gerald Zukrigl
 
the abstract class should be defined by the application, not in the assembly
containing a plugin. This sounds like you have the pluginbase type defined
twice, one in the plugin assembly, and one in your main application.
Create an assembly that has nothing but type definitions for your plugins
and possibly plugin related helper classes(if applicable). Then reference
that assembly in both your plugin and in the main application.
 
Back
Top