I have been using Task.Factory.ContinueWhenAny() for while and just decided to examine other options. So I referred to it's MSDN reference page and the syntax for this commands is described as:
public Task<TResult> ContinueWhenAny<TResult>(
Task[] tasks,
Func<Task, TResult> continuationFunction,
CancellationToken cancellationToken
)
It's clear to me that the parts mentioned inside < & > are types, such as the expected return value of a type TResult in Task<TResult>. However I am not quite sure what this part of this syntax would mean:
Func<Task, TResult> continuationFunction
As you can see there are two parameters sandwiched inside <> and separated by a comma.
It's a Func delegate and it's declared like this:
public delegate TResult Func<in T, out TResult>(T arg);
It represents a function that takes a Task parameter and returns a result of type TResult.
It is similar to:
TResult ContinuationFunction<T,TResult>(T arg) { ... }
Further reading
Func<T, TResult> DelegateIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With