How to determine implemented interface

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
 
M

Mattias Sjögren

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
 
A

Armin Zingler

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
 

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