// Enumerates plug-ins within all file within file list private IEnumerable <PluginKeyValuePair <T> > GetPlugins() { foreach (var file in _fileInfo) { foreach (var plugin in _pluginFetcher.GetPluginTypes(file.FullName)) { var pluginInfo = new InfoConstructor(plugin).GetPluginInfo(); if (_pluginInfoPredicate.Invoke(pluginInfo)) { yield return(new PluginKeyValuePair <T>(pluginInfo)); } } } }
public TService GetService <TService>() { Type type = typeof(TService); if (!_Instances.ContainsKey(type)) { throw new ArgumentOutOfRangeException("TService", "TService is not register"); } if (_Instances[type] == null) { InfoConstructor ctor = _InfoCtors[type]; // Permet d'instancier un objet via son constructeur (en fonction des parametres) _Instances[type] = Activator.CreateInstance(ctor.TypeService, ctor.Parametres); } return((TService)_Instances[type]); }