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

Re: Version independent equivalent to the "is" operator... by Mattias

Mattias
Thu Sep 22 00:54:48 CDT 2005

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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.