G
Guest
Hi All,
I want to create an instance of an object that implements a known interface.
I just want to pass the assembly location and name followed by the class. My
code looks like this:
// The OK part
IMyInterface MyInstance;
System.RunTime.Remoting.ObjectHandle Oh =
System.Activator.CreateInstanceFrom(MyAssembly.dll, MyClass);
// Then cast to instance
MyInstance = (IMyInterface) Oh.CreateObjectRef(???) // Not sure what should
go here
Both MyAssembly.dll and MyClass are strings that give the location + name and
class to use to construct the object instance
MyClass implements IMyInterface
I want to use MyInstance as I would have done had it been early bound.
I just don't know how to urn the handle into an instance of the object.
Any ideas anyone?
I want to create an instance of an object that implements a known interface.
I just want to pass the assembly location and name followed by the class. My
code looks like this:
// The OK part
IMyInterface MyInstance;
System.RunTime.Remoting.ObjectHandle Oh =
System.Activator.CreateInstanceFrom(MyAssembly.dll, MyClass);
// Then cast to instance
MyInstance = (IMyInterface) Oh.CreateObjectRef(???) // Not sure what should
go here
Both MyAssembly.dll and MyClass are strings that give the location + name and
class to use to construct the object instance
MyClass implements IMyInterface
I want to use MyInstance as I would have done had it been early bound.
I just don't know how to urn the handle into an instance of the object.
Any ideas anyone?