Blank
Blank
Explore posts from servers
VVALORANT
Created by Blank on 11/20/2024 in #community-help
Error code -1
No description
8 replies
VVALORANT
Created by Blank on 11/10/2024 in #community-help
How does Valorant determine latency and packet loss?
Which networking protocols are being used here?
1 replies
CC#
Created by Blank on 10/18/2024 in #help
Extra bytes in TCP message
No description
6 replies
CC#
Created by Blank on 2/2/2024 in #help
✅ 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 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 will be printed to the console before 2. But its not the case. Please explain... 😭
54 replies