Last active
March 12, 2018 08:05
-
-
Save iamsunny/85934386d17a87c8a815a6527c86b4c7 to your computer and use it in GitHub Desktop.
C# Class with an Async Method
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
class AsyncMethods | |
{ | |
/// <param name="sleepTime">sleep time in seconds</param> | |
public async Task<bool> SleepAsync(int sleepTime) | |
{ | |
Console.WriteLine($"SleepAsync for {sleepTime} seconds starts"); | |
await Task.Delay(sleepTime*1000); | |
Console.WriteLine($"SleepAsync for {sleepTime} seconds completes"); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment