Last active
          August 29, 2015 14:23 
        
      - 
      
- 
        Save joymon/06c10ff08b9afb7e45b7 to your computer and use it in GitHub Desktop. 
    Write factorial using ADI
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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