all groups > dotnet general > december 2003 >
You're in the

dotnet general

group:

Type casting problem...Please help me


Type casting problem...Please help me KK
12/20/2003 8:26:12 PM
dotnet general:
Hi All
i have an interface like this in file Interface.h
__gc __interface IParam
{

};

My implementation class is like this
public __gc class Param : IParam
{
}

The ablove implementation class is in a separate assembly.

In my application i'm using Activator::CreateInstance to create class from
Assembly dynamically
System.Runtime.Remoting.ObjectHandle * hdl ;
hdl = Activator::CreateInstance(AssemblyName, ClassName)

IParam = __try_cast<IParam*>(hdl->Unwrap());

here i'm getting invalid cast operation...
I have included IParam interface in my app as source file.
Can anybody help me what's going wrong..

Thanks and Regards
Krishna



Re: Type casting problem...Please help me Jon Skeet [C# MVP]
12/20/2003 11:59:58 PM
[quoted text, click to view]

<snip>

[quoted text, click to view]

I suspect that including the IParam interface in your app is the
problem. Have a look at http://www.pobox.com/~skeet/csharp/plugin.html
- it's looking at things from a C# perspective, but I suspect the same
principles apply.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button