N
n!
Hiya,
One thing I used interfaces for when using C++ was defining lots of
header files for each interface being used, and allowing users to simply
#include the appropriate header file and use the interface immediately, no
linking required.
I had hoped that C# would allow me to do similar by defining the exact same
interface (namespace + contents) in multiple assemblies. As there are a few
assemblies I'd like to share the same interface, but be independant from
each other. I wrote a simple test for this, as I wasn't sure C# would like
it, by defining the interface in my executable and another assembly and
using a third assembly as a proxy to create an object instance. Meaning my
executable was not linked to the third assembly, but had an exact, matching
interface defined within it.
I seem to have confused it It compiles fine, and I even get a valid
object within my reference inside the executable. However as soon as I try
and call the interface I get an exception, this is something I was
expecting, but had hoped didn't happen
Anyway, to get to the root of my problem. The only way around this I can
think of is define an 'interface' assembly which contains only interfaces
and have all clients reference that. Not ideal but workable. So I was
wondering if anyone had any other thought before I decide on that.
thanks
n!
One thing I used interfaces for when using C++ was defining lots of
header files for each interface being used, and allowing users to simply
#include the appropriate header file and use the interface immediately, no
linking required.
I had hoped that C# would allow me to do similar by defining the exact same
interface (namespace + contents) in multiple assemblies. As there are a few
assemblies I'd like to share the same interface, but be independant from
each other. I wrote a simple test for this, as I wasn't sure C# would like
it, by defining the interface in my executable and another assembly and
using a third assembly as a proxy to create an object instance. Meaning my
executable was not linked to the third assembly, but had an exact, matching
interface defined within it.
I seem to have confused it It compiles fine, and I even get a valid
object within my reference inside the executable. However as soon as I try
and call the interface I get an exception, this is something I was
expecting, but had hoped didn't happen
Anyway, to get to the root of my problem. The only way around this I can
think of is define an 'interface' assembly which contains only interfaces
and have all clients reference that. Not ideal but workable. So I was
wondering if anyone had any other thought before I decide on that.
thanks
n!