示例#1
0
        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)));
        }
示例#2
0
        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)));
        }