Skip to content

Instantly share code, notes, and snippets.

@renestein
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renestein/44e20c502148db05a806 to your computer and use it in GitHub Desktop.
Save renestein/44e20c502148db05a806 to your computer and use it in GitHub Desktop.
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