q1) does Task.Run creast async task? (it is writen it runs on an other thread.)
q2) if it does create async task then why and when we need Task.Run(async ()={}).
pls explan with examples.
q1) does Task.Run creast async task? (it is writen it runs on an other thread.)
q2) if it does create async task then why and when we need Task.Run(async ()={}).
pls explan with examples.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jack AbroyPosted Jul 17, 2025, 8:34 AM
Use
asyncto write clear, non-blocking code that naturally handles asynchronous work.Task.Runjust offloads work to a threadasyncis better for I/O tasks and responsiveness.Deepika SawantPosted Jul 15, 2025, 3:59 PM
Q1: Does
Task.Runcreate an async task?Yes, but with a nuance.
Task.Runqueues work to the thread pool and returns aTaskthat represents that work.awaitinside the delegate allows the thread to be released during I/O-bound operations.Q2: Why and when do we use
Task.Run(async () => { ... })?This pattern is useful when:
async.When NOT to use
Task.Run(async () => { ... })awaitthe async call directly.