use LINQ and Parallel Tasks
var stuff = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
Parallel.ForEach(stuff, p=>{ //do things in parallel.. });
//or this
var q = stuff.AsParallel().Where(x => p(x)).Orderby(x => k(x)).Select(x => f(x));
foreach (var e in q) a(e);