I’m currently designing some internal APIs where I use the Async CTP and its new await/async keywords.
Are there any guidelines or best practices on how these APIs should be designed?
Specifically:
- Should I provide both a synchronous and an asynchronous version of methods? (i.e.
Task DoStuffAsync()andvoid DoStuff() - Should all async methods I expose be in the form
async Task<T> GetStuffAsync()(i.e. method name end withAsync) or is it ok to to have something namedGetStuff()be awaitable?
I do understand that it’s not all black or white here, and that it depends on the method in question, but I’m looking for general guidelines.
Hard to find the nuggets, most publications are focused on the client programming side. Good stuff is:
Do keep in mind this is all preview, important details may change before this ships.