Asynchronous Thread.Sleep()

Do you mean:

Task.Delay(1000).ContinueWith(t => workB());

Alternatively, create a Timer manually.

Note this looks prettier in async code:

async Task Foo() {
    workA();
    await Task.Delay(1000);
    workB();
}

edit: with your .NET 2.0 update, you would have to setup your own Timer with callback. There is a nuget package System.Threading.Tasks that brings the Task API down to .NET 3.5, but a: it doesn’t go to 2.0, and b: I don’t think it includes Task.Delay.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)