OK, the loaded DLL is in C++.NET, but the common
interfaces DLL and the loader are in C#
I solved the problem by deriving from a class within the
dynamically loaded DLL, instead of trying to derive from
an interface.
I put a default implementation class of the interface into
a common DLL, which I then derive from in the dynamic
module. This gives me a valid instance, so the problem is
solved for me.
Thanks for the response,
Mike
-----Original Message-----
MKoleoso <mk******@cae-gmbh.de> wrote: Problem: C#- Unable to create instance of a class
implementing from an interface
I have:
namespace someNamespace
{
public __gc class SomeClass1
{
}
public __gc class SomeClass2: public ISomeInterface
{
}
}
I'm trying to create instances of them both using
Assembly.CreateInstance("..."),
but SomeClass2 fails because it is flagged as an
abstract class. I get the exception:
Cannot create an abstract class.
What do I need to be able to create instances of
classes implementing interfaces?
With the code you posted above, it should be okay.
(Having said that,I'm not sure what the __gc bit is doing there - I thought
that was amanaged C++ thing?)
Could you post a short but complete program demonstrating
your problem?See http://www.pobox.com/~skeet/csharp/complete.html
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
.