Created
          June 24, 2015 16:17 
        
      - 
      
- 
        Save joymon/b2a908226782e6b5aa7e to your computer and use it in GitHub Desktop. 
    Writes factorial using TPL
  
        
  
    
      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 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