public void RemoveAll() { foreach (UIType type in this.uis.Keys.ToArray()) { UI ui; if (!this.uis.TryGetValue(type, out ui)) { continue; } this.uis.Remove(type); ui.Dispose(); } }