Linked Questions
15 questions linked to/from Is Async await keyword equivalent to a ContinueWith lambda?
10 votes
3 answers
268 views
What is the difference between using only async Task and Task? [duplicate]
For example, the difference between this code public Task<IList<NewsSentimentIndexes>> GetNewsSentimentIndexes(DateTime @from, DateTime to = new DateTime(), string grouping = "1h&...
1 vote
1 answer
440 views
Is await the equivalent of creating a continuation with the TaskContinuationOptions.AttachedToParent option? [duplicate]
Possible Duplicate: Is Async await keyword equivalent to a ContinueWith lambda? Edit: I see this question has been marked as a duplicate, but it's not quite the same. I'm specifically asking about ...
167 votes
2 answers
82k views
Difference between await and ContinueWith
Can someone explain if await and ContinueWith are synonymous or not in the following example. I'm trying to use TPL for the first time and have been reading all the documentation, but don't understand ...
60 votes
3 answers
19k views
How can I tell if a C# method is async/await via reflection?
e.g. class Foo { public async Task Bar() { await Task.Delay(500); } } If we are reflecting over this class and method, how can I determine if this is an actual async/await method rather than simply a ...
52 votes
3 answers
76k views
Is Async/Await using Task.Run starting a new thread asynchronously?
I have read a lot of articles and still cant get understand this part. Consider this code : private async void button1_Click(object sender, EventArgs e) { await Dosomething(); } ...
20 votes
1 answer
35k views
Why is AsyncContext needed when using async/await with a console application?
I'm calling an async method within my console application. I don't want the app to quit shortly after it starts, i.e. before the awaitable tasks complete. It seems like I can do this: internal ...
5 votes
3 answers
2k views
Configuring the continuation behaviour of a TaskCompletionSource's Task
Consider the following code: public Task SomeAsyncMethod() { var tcs = new TaskCompletionSource(); ... do something, NOT setting the TaskCompletionSource... return tcs.Task } public ...
8 votes
1 answer
24k views
Task execution with and without await operator
I asked a question yesterday and the answer was good. But now I'm trying to understand the role of await and how task execution works. I've read about await that: The await operator is applied to a ...
15 votes
1 answer
1k views
Sequential await VS Continuation await
I was wondering what is the best/correct way of writing asynchronous code that is composed of two (or more) async and dependent (the first have to finish to execute second) operations. Example with ...
5 votes
2 answers
6k views
Callback with async and await
I have questions regarding the execution order of async jobs. I will ask my question with example because it is easier to be understandable. It is an official example from https://msdn.microsoft.com/...
1 vote
2 answers
2k views
Chaining `Task<T>` dynamically and without blocking the thread
I am trying to chain Task<T> objects in C# as done in JavaScript and without blocking the UI thread. I see there is a similar question here, but it uses the non-generic Task object as a return ...
3 votes
2 answers
790 views
Sharing variable in ContinueWith(anotherTask) + C# Task Parallel Library
I create a task with continuationWith(anotherTask) as below. I want to find out the time taken for completing its work by the first task. I share the variable "task1StartedDateTime" between task1 and ...
3 votes
3 answers
606 views
Do multiple awaits to the same Task from a single thread resume in FIFO order?
Supposing a Task is created and awaited multiple times from a single thread. Is the resume order FIFO? Simplistic example: Is the Debug.Assert() really an invariant? Task _longRunningTask; async ...
2 votes
3 answers
112 views
Parameterized action
I accidentally bumped into an issue, that I was able to resolve. However, I am a worried about my inability to understand why the error-ed code was able to compile (at first place). Following is the ...
1 vote
1 answer
97 views
Now that we have an "await" keyword, is there any benefit to using ContinueWith method?
Picture the following code: var client = new HttpClient(); var response = await client.GetAsync("www.someaddress.yo"); string content = await response.Content.ReadAsStringAsync(); Is there any added ...