Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Writes factorial using TPL
private void WriteFactorialAsyncUsingTask(int no)
{
Task<int> task=Task.Run<int>(() =>
{
int result = FindFactorialWithSimulatedDelay(no);
return result;
});
task.ContinueWith(new Action<Task<int>>((input) =>
{
Console.WriteLine("Factorial of {0} is {1}", no, input.Result);
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.