Guest User

Untitled

a guest
Nov 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. public void RunForever(Action method, TimeSpan timeSpan)
  2. {
  3. _runnerTask = Task.Delay(timeSpan, _cancellationTokenSource.Token).ContinueWith((a)=>
  4. {
  5. method();
  6. if (a.IsCanceled)
  7. {
  8. return;
  9. }
  10. RunForever(method, timeSpan);
  11. });
  12. }
  13. }
Add Comment
Please, Sign In to add comment