From the Microsoft APIs and reference documentation, I can read:
public Task<TNewResult> ContinueWith<TNewResult>(
Func<Task<TResult>, TNewResult> continuationFunction
)
Parameters
continuationFunction
Type: System.Func<Task<TResult>, TNewResult>
A function to run when the Task completes. When run, the delegate will be passed the completed task as an argument.
Can't figure out, by which mechanism the Parameters continuationFunction refers to the Task.
For example:
public static Task<DateTimeOffset?> GetLastModified()
{
HttpClient theRequest = new HttpClient();
var theTask = theRequest.GetAsync("https://www.yahoo.com/news/rss");
return theTask.ContinueWith((Task<HttpResponseMessage> antecedent) => {
return antecedent.Result.Content.Headers.LastModified;
});
}
How antecedent is linked with theTask?