private void RefreshDictionary() { var pluginScriptContainers = _PluginProvider.GetPlugins(); // Add a new assembly for any new or updated plugin foreach (var pluginScriptContainer in pluginScriptContainers) { var name = pluginScriptContainer.Name; var version = pluginScriptContainer.Version; if (!_Dictionary.Any(a => a.Name == name && a.Version == new Version(version))) { var assembly = _PluginLoader.Load(pluginScriptContainer); Add(name, version, assembly); } } // Remove any assemblies which we no longer have a plugin for. _Dictionary .RemoveAll(dictionaryEntry => !pluginScriptContainers .Select(plugin => plugin.Name) .Contains(dictionaryEntry.Name)); }