Version independent equivalent to the "is" operator...

N

Nathan Baulch

What is the best way to find out if a certain object implements any version
of a specific interface?

I have a plugin system in which plugins implement interfaces stored in
strongly named assembly in the GAC.
The plugins, which are dynamically loaded by the host, could potentially
reference any version of that assembly.

Do I need to manually search through the Assembly.GetReferencedAssemblies
and compare based on Name+PublicKey?
And once I confirm that it implements the interface, can I only use
reflection to call its members?


Nathan
 
M

Mattias Sjögren

Nathan,
And once I confirm that it implements the interface, can I only use
reflection to call its members?

Yes. Wouldn't it be easier to use binding redirects or publisher
policy to redirect all previous versions of the plugin assembly to the
latest one, and then just use the is operator and call through the
interface?


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top