How to determine implemented interface

  • Thread starter Thread starter Tosch
  • Start date Start date
T

Tosch

I have written an interface, let's call it AddinInterface1.
At some stage I had to add more properties to the interface.
So I wrote a new interface, AddinInterface2 which inherits AddinInterface1.

My application tries to load DLLs which implement AddinInterface1. If I have a DLL which implements AddinInterface2 I have to set some additional
properties.
How can I determine in my application which interface is implemented in a DLL?

Tosch
 
How can I determine in my application which interface is implemented in a DLL?

DLLs don't implement interfaces, classes do. You can use Reflection to
determine if a certain type in an assembly implements a particular
interface (with Type.IsAssignableFrom() for example). Or if you have
already instantiated the object, you can use the TypeOf .. Is
operator.



Mattias
 
Tosch said:
I have written an interface, let's call it AddinInterface1.
At some stage I had to add more properties to the interface.
So I wrote a new interface, AddinInterface2 which inherits
AddinInterface1.

My application tries to load DLLs which implement AddinInterface1. If
I have a DLL which implements AddinInterface2 I have to set some
additional properties. How can I determine in my application which
interface is implemented in a DLL?


If TypeOf o is AddinInterface2 Then
'...
elseIf TypeOf o is AddinInterface1 Then
'...
end if


Armin
 
Back
Top