© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
53 replies
Blank

✅ Confused about Asynchronous Programming

I have been reading about Asynchronous programming for a long time but the concepts are not going through me.

From what I learnt, one way of calling async tasks is like this:
var task1 = sometask();
// Do something else
var result = await task1;
var task1 = sometask();
// Do something else
var result = await task1;
Okay so I understand this one. A task is started, some other work is done, and then the task is asked to return the result.

But what about this one:
var result = await someTask();
// Do something else
var result = await someTask();
// Do something else

Now how is this different from calling the method synchronously? We called the task and are now waiting for it to finish the next moment.

Also, some articles say that the
await
await
keyword suspends the execution of the current method and returns the control to the caller. From what I understand, its like:
static async Task Main()
{
    await someTask();
    Console.WriteLine(1);
}

static async Task someTask()
{
    // Do something
    await someOtherTask();
    // Do something else
    Console.WriteLine(2);
}
static async Task Main()
{
    await someTask();
    Console.WriteLine(1);
}

static async Task someTask()
{
    // Do something
    await someOtherTask();
    // Do something else
    Console.WriteLine(2);
}

The
1
1
will be printed to the console before
2
2
. But its not the case.

Please explain... 😭
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
Next page

Similar Threads

❔ Asynchronous TCP-programming
C#CC# / help
3y ago
✅ confused about classes
C#CC# / help
3y ago
Confused about if statements
C#CC# / help
2y ago
✅ Confused about publish options
C#CC# / help
3y ago