kandi X-RAY | AsyncFixer Summary
kandi X-RAY | AsyncFixer Summary
AsyncFixer
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AsyncFixer
AsyncFixer Key Features
AsyncFixer Examples and Code Snippets
Community Discussions
Trending Discussions on AsyncFixer
QUESTION
Given the following code snippet of an aspnet
controller, is it a requirement to have async
/await
at the top level, or is it valid to return a Task
?
The scenario assumes there is some IO (data access) that uses async in underlying code in the repository.
controller
...ANSWER
Answered 2020-May-15 at 23:16First, it's important to note that either way, the code is asynchronous.
That said, I generally recommend people to start with async
/await
everywhere and then only elide the keywords in trivial cases. There are several caveats when eliding async
and await
, including exceptions and using
statements. So as a general rule, if the implementation is truly trivial (literally just "forward to another method"), then feel free to elide async
/await
; everywhere else, keep the async
/await
keywords. They have minimal overhead and guarantee correct semantics for nontrivial methods.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AsyncFixer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page