A
Ashutosh
Hi,
Have few doubts in using an assembly in different appdomain.
Besides reflection what are the other way to consume a type in a
assembly which is loaded at runtime using AppDomain.Load or
Assembly.Load[From] ?
What about marshaling the data between app domain?? Should the type in
the assembly inherit from MarshalByRefObject class?
Lastly, why can't I use an interface to assess the object of the class
thats loaded like this
AppDomain d = AppDomain.CreateDomain("ashuu");
Assembly a = d.Load("ClassLibrary1, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=c4510fb7f9c15154");
object o = a.CreateInstance("ClassLibrary1.TestClass123");
ISayHello h = o as ISayHello;
if (h != null) //<--------- h is always null
h.Hello();
The class ClassLibrary1.TestClass123 implements the interface ISayHello,
but the object h (shown above) is always null.
Can someone please clarify?
Thanks & Regards,
Ashutosh
Have few doubts in using an assembly in different appdomain.
Besides reflection what are the other way to consume a type in a
assembly which is loaded at runtime using AppDomain.Load or
Assembly.Load[From] ?
What about marshaling the data between app domain?? Should the type in
the assembly inherit from MarshalByRefObject class?
Lastly, why can't I use an interface to assess the object of the class
thats loaded like this
AppDomain d = AppDomain.CreateDomain("ashuu");
Assembly a = d.Load("ClassLibrary1, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=c4510fb7f9c15154");
object o = a.CreateInstance("ClassLibrary1.TestClass123");
ISayHello h = o as ISayHello;
if (h != null) //<--------- h is always null
h.Hello();
The class ClassLibrary1.TestClass123 implements the interface ISayHello,
but the object h (shown above) is always null.
Can someone please clarify?
Thanks & Regards,
Ashutosh