back

by danabramov·13y ago·view on hn ↗
It is a convention, often used to differentiate blocking and asynchronous methods in the APIs (e.g. `Read` and `ReadAsync`, etc). You're not required to use it, but it is useful whenever there is a chance of confusion.

As for the timeouts, it would be strange to bake this into a language (different platforms may support different timers, at the very least).

Instead, you use library for this[1]:

    int timeout = 1000;
    var task = SomeOperationAsync();
    if (await Task.WhenAny(task, Task.Delay(timeout)) == task) {
        // task completed within timeout
    } else { 
        // timeout logic
    }
Instead of awaiting on a task, you await on `WhenAny` combinator.

[1]: http://stackoverflow.com/a/11191070/458193