public static Type GetImplementation <T>(Func <Assembly, bool> predicate) { IEnumerable <Type> implementations = ExtensionManager.GetImplementations <T>(predicate); if (implementations.Count() == 0) { throw new ArgumentException("Implementation of " + typeof(T) + " not found"); } return(implementations.FirstOrDefault()); }
public static IEnumerable <T> GetInstances <T>(Func <Assembly, bool> predicate) { List <T> instances = new List <T>(); foreach (Type implementation in ExtensionManager.GetImplementations <T>()) { if (!implementation.GetTypeInfo().IsAbstract) { T instance = (T)Activator.CreateInstance(implementation); instances.Add(instance); } } return(instances); }
public static IEnumerable <Type> GetImplementations <T>() { return(ExtensionManager.GetImplementations <T>(null)); }
public static List <Type> GetImplementations <T>() { return(ExtensionManager.GetImplementations <T>(null)); }