📅  最后修改于: 2022-03-11 14:49:13.134000             🧑  作者: Mango
static async Task> Where(
this IEnumerable source, Func> predicate)
{
var results = new ConcurrentQueue();
var tasks = source.Select(
async x =>
{
if (await predicate(x))
results.Enqueue(x);
});
await Task.WhenAll(tasks);
return results;
}
var filteredAddresses = await addresses.Where(MeetsCriteria);