Created
June 1, 2019 19:07
-
-
Save aliabidzaidi/d94607a7db39c90c9fc88403195f33c2 to your computer and use it in GitHub Desktop.
Creating & Executing Tasks Lazily
This file contains 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
Lazy<Task<string>> lazyTask = new Lazy<Task<string>>(() => | |
Task<string>.Factory.StartNew(() => | |
{ | |
Console.WriteLine("Task Body Working ....."); | |
return "TaskBody Result"; | |
}) | |
); | |
Console.WriteLine("Accessing lazy Task Result {0}", lazyTask.Value.Result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment