Last active
August 29, 2015 14:02
-
-
Save renestein/44e20c502148db05a806 to your computer and use it in GitHub Desktop.
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
public async Task<string> WaitAsync() | |
{ | |
//Start metody, metoda běží synchronně | |
await Task.Delay(DEFAULT_DELAY_MS); | |
//”zapauzování metody” a odchod z metody | |
//Metoda je roztržena na dvě části – z řádku níže, který ještě neproběhl, je vytvořena tzv. “continuation” | |
// Continuation = delegát, který je předán awaiteru a ten je povinen delegáta spustit, až bude tásk vydaný z metody Delay dokončen. | |
//……………Metoda neběží | |
//……………Metoda neběží | |
//……………Metoda neběží | |
//Čekání skončilo, konec pauzy. Je spuštěna continuation. | |
return "Finished"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment