i have a database in a server and it seems like the async method doesn\'t work.
Here is my code:
static async void Example()
{
string connectionS
Well, it could be that there's a pooled connection that's already open. In which case, it would be returned to you synchronously.
The thing to notice is that await does not necessarily return control back to the calling method. It only returns to the calling method if the status of the task being awaited is TaskStatus.Running. If the task has completed, then execution carries on as normal.
Try awaiting this method, which returns a task with status RanToCompletion:
public Task SampleMethod()
{
return Task.FromResult(0);
}