public void StopObject(Type type) { if (!hash.ContainsKey(type)) { return; } RegisteredItem reg = hash [type]; reg.Item.Stop(false); }
void OnDomainUnload(object sender, EventArgs args) { Manager.RemoveHost(AppID); ICollection <RegisteredItem> values = hash.Values; RegisteredItem [] objects = new RegisteredItem [hash.Count]; values.CopyTo(objects, 0); foreach (RegisteredItem reg in objects) { try { reg.Item.Stop(true); // Stop should call Unregister. It's ok if not. } catch { // Ignore or throw? } } hash.Clear(); }
void OnDomainUnload (object sender, EventArgs args) { Manager.RemoveHost (AppID); ICollection<RegisteredItem> values = hash.Values; RegisteredItem [] objects = new RegisteredItem [hash.Count]; values.CopyTo (objects, 0); foreach (RegisteredItem reg in objects) { try { reg.Item.Stop (true); // Stop should call Unregister. It's ok if not. } catch { // Ignore or throw? } } hash.Clear (); }