I've read so many posts on this, some of which are conflicting (possibly due to the age of the posts), so I just want to confirm my understanding of "best practices" as of .NET 4.8.
For an async method that returns Task
ResponseObject response = myAsyncTask.GetAwaiter().GetResult();
And for an async method that returns Task, then we should use:
var t = new Task(async () => await myAsyncTask().ConfigureAwait(false));
t.RunSynchronously();
No comments:
Post a Comment