public RemoteDomain(string appBase) { // Create the domain. AppDomainSetup info = new AppDomainSetup(); info.ApplicationBase = appBase; m_domain = AppDomain.CreateDomain("RemoteWorkerDomain", null, info); // Create the worker. m_worker = (RemoteWorker)m_domain.CreateInstanceFrom(typeof(RemoteWorker).Assembly.CodeBase, typeof(RemoteWorker).FullName).Unwrap(); }
void IDisposable.Dispose() { try { m_worker = null; if (m_domain != null) { AppDomain.Unload(m_domain); m_domain = null; } } catch (Exception) { } }