3 ms·
> the complexity of getting async “right” For most single-context use cases, it's no harder or difficult than async/await in JavaScript and hardly anyone would
by CharlieDigital 3y ago
> the complexity of getting async “right”
For most single-context use cases, it's no harder or difficult than async/await in JavaScript and hardly anyone would call JavaScript "complex".
Promise (JS) = Task (C#)
Promise<T> (TS) = Task<T> (C#)
Promise.all() = Task.WhenAll()
For multi-context use cases, there's just a bit of awareness required to understand that you may need continuation on the original thread and awareness of context-sensitive resources. But if you're building web API backends, most of the time, it's not a concern and async/await works (mostly) like JS because the dependency injection container is playing a big role in handling object scopes.
C# has to be one of the more approachable languages for most teams that are already versed in JS/TS because of the similarity[0] and influence of C# on JS and TS (JS async/await came after C#; same for JS lambdas)
[0] https://github.com/CharlieDigital/js-ts-csharp https://github.com/CharlieDigital/js-ts-csharp