Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Write factorial using ADI
private void WriteFactorialAsyncUsingDelegate(int facno)
{
Func<int, int> findFact = FindFactorialWithSimulatedDelay;
findFact.BeginInvoke(facno,
(iAsyncresult) =>
{
AsyncResult asyncResult = iAsyncresult as AsyncResult;
Func<int, int> del = asyncResult.AsyncDelegate as Func<int, int>;
int factorial = del.EndInvoke(asyncResult);
Console.WriteLine("Factorial of {0} is {1}", facno, factorial);
},
null);
}
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.