← Back to context

Comment by shortrounddev2

3 days ago

I don't see how that changes things. You'd have to async it all the way to the top but the syntax is still cleaner than F#. If you're using an Asp.Net controller you just declare the handler as async Task<IActionResult> and it's fine. Even program main methods can be async these days

The syntax is exactly the same. You have `var x = await` in C# and `let! x =` in F#

The controller handler is also the same. It will be marked with `async` keyword in C# and `task` CE in F#

  • It's absolutely not exactly the same; let! is only available within a computation block. If you want to return some value from the computation block and return to Functional land without having to pause the thread you need to use a continuation, which C# has built in syntactic sugar for in async/await and F# does not.