Asynchronous Delegates Vs Thread/ThreadPool?

前端 未结 8 2184
醉梦人生
醉梦人生 2020-12-22 23:57

I need to execute 3 parallel tasks and after completion of each task they should call the same function which prints out the results.

I don\'t understand in .net why

8条回答
  •  爱一瞬间的悲伤
    2020-12-23 00:30

    A async method essentially abstracts away the way the work is actually being processed. It may be spawned out into a new process, it may be executed in a separate thread...It doesn't matter.

    All that matters is you are saying:

    1. Run this code when you start.
    2. And run this code when you finish.

    If given the choice, I'll use a API async method over implementing my own threading mechanism every-time. The framework developers did the hard work for you, why reinvent the wheel.

提交回复
热议问题