Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Demo of MoreLINQ's AwaitCompletion
<Query Kind="Expression">
<NuGetReference Prerelease="true">morelinq</NuGetReference>
.Range(1, 5)
.Select(x => TimeSpan.FromSeconds(x))
.Pipe(e => Console.WriteLine($"Job #{e.Key} will take {e.Value}"))
.AwaitCompletion(async (x, _) => { await Task.Delay(x.Value); return x; },
(x, t) => t.Result)
// .AsSequential()
// .AsOrdered()
// .MaxConcurrency(2)
.Pipe(e => Console.WriteLine($"Job #{e.Key} completed"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.