/// <summary> /// Gets the exports. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param> /// <returns>IEnumerable{``0}.</returns> public IEnumerable <T> GetExports <T>(bool manageLiftime = true) { var currentType = typeof(T); Logger.Info("Composing instances of " + currentType.Name); var parts = AllConcreteTypes.AsParallel().Where(currentType.IsAssignableFrom).Select(CreateInstance).Cast <T>().ToArray(); if (manageLiftime) { lock (DisposableParts) { DisposableParts.AddRange(parts.OfType <IDisposable>()); } } return(parts); }
/// <summary> /// Gets the export types. /// </summary> /// <typeparam name="T"></typeparam> /// <returns>IEnumerable{Type}.</returns> public IEnumerable <Type> GetExportTypes <T>() { var currentType = typeof(T); return(AllConcreteTypes.AsParallel().Where(currentType.IsAssignableFrom)); }