public static Task <IEnumerable <Type> > FindTypes(Assembly assembly, TypeClassification classification, Func <Type, bool> filter = null) { if (assembly == null) { return(Task.FromResult((IEnumerable <Type>) new Type[0])); } var query = new TypeQuery(classification, filter); return(ForAssembly(assembly).ContinueWith(t => query.Find(t.Result))); }
/// <summary> /// Find types matching a certain criteria and TypeClassification from an Assembly /// </summary> /// <param name="assemblies"></param> /// <param name="classification"></param> /// <param name="filter"></param> /// <returns></returns> public static Task <IEnumerable <Type> > FindTypes(IEnumerable <Assembly> assemblies, TypeClassification classification, Func <Type, bool> filter = null) { var query = new TypeQuery(classification, filter); var tasks = assemblies.Select(assem => ForAssembly(assem).ContinueWith(t => query.Find(t.Result))).ToArray(); return(Task.Factory.ContinueWhenAll(tasks, results => results.SelectMany(x => x.Result))); }