.NET     Console.WriteLine( "All Things .NET" );
.NET Nerd Blog Home
4.05.2002

 

AppDomains


Creating a type in another AppDomain is really very simple - especially in this case where the type is in the currently executing assembly.


// they say CreateInstanceAndUnwrap needs fully qualified name,
// but after all the trouble, the "name" only is enough.
// i had trouble cuz the type name needs to be fully qual'd
// too - including the namespace
Assembly ass = Assembly.GetExecutingAssembly();
string sName = ass.FullName; // we dont end up using this after all
AppDomain newDom = AppDomain.CreateDomain( "AdderDomain" );
object o = newDom.CreateInstanceAndUnwrap( "InteropTiming", "InteropTiming.LocalAdder" );
LocalAdder a = (LocalAdder)o;




Comments: Post a Comment

Powered by Blogger