Skip to content

Instantly share code, notes, and snippets.

@KennethanCeyer
Created March 9, 2017 07:17
Show Gist options
  • Save KennethanCeyer/7aa42474cfbe58d6acda2d85d0b2f17f to your computer and use it in GitHub Desktop.
Save KennethanCeyer/7aa42474cfbe58d6acda2d85d0b2f17f to your computer and use it in GitHub Desktop.
Async Task Without await
[HttpPost]
publicJsonResult Wait(int time)
{
Task.Factory.StartNew(() => {
Thread.Sleep(time);
Debug.WriteLine("Done " + time);
});
return APPActor.GetJson(new
{
msg = time
});
}
[HttpPost]
public async Task<JsonResult> Wait(int time)
{
// This will go to doen't working.
Task.Factory.StartNew(() => {
Thread.Sleep(time);
Debug.WriteLine("Done " + time);
}).ConfigureAwait(false);
return await APPActor.GetJsonAsync(new
{
msg = time
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment