© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
9 replies
Jamie Brown

✅ await await ContinueWith

Can anyone help me with why I need to await the call in
DoStuff()
DoStuff()
twice?
I'd normally just sequentially await the calls but thought I'd experiment with
ContinueWith
ContinueWith
and this seems bizarre?
Maybe I'm missing something or just plain not using it correctly? 😅
public interface IFoo
{
    public Task<List<int>> NumberSource();
    public Task<List<int>> Double(List<int> numbers);
}

public class Bar
{
    private readonly IFoo _foo;
    // ... 
    public async Task<List<int>> DoStuff()
    {
        // Why the double await here???????
        return await await _foo.NumberSource()
            .ContinueWith(async numbers => await _foo.Double(await numbers));
    }
}
public interface IFoo
{
    public Task<List<int>> NumberSource();
    public Task<List<int>> Double(List<int> numbers);
}

public class Bar
{
    private readonly IFoo _foo;
    // ... 
    public async Task<List<int>> DoStuff()
    {
        // Why the double await here???????
        return await await _foo.NumberSource()
            .ContinueWith(async numbers => await _foo.Double(await numbers));
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Async/Await question
C#CC# / help
2w ago
✅ await in c#
C#CC# / help
2y ago
Await Linq Expression
C#CC# / help
4y ago
❔ Async Await On Logging - Waiting Response Without Await Keyword
C#CC# / help
4y ago