Wasn't it .NET 4.0 TPL that made APM, EAP and BackgroundWorker asynchronous patterns obsolete?

前端 未结 3 1424
生来不讨喜
生来不讨喜 2020-12-24 02:54

I have 2 kinds of C# WPF app projects:

  • based on .NET 4.0 that I cannot migrate to .NET 4.5
  • based on .NET 4.0 that I can migrate to .NET 4.5
  • <
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 03:29

    My question was:

    Wasn't it .NET 4.0 TPL that made APM, EAP and BackgroundWorker asynchronous patterns obsolete?

    i.e. a doubt, asking for confirmation or negation that if something is obsolete in .NET 4.5, then I do not see why and how it can be different in .NET 4.0, i.e. with Task Parallel Library (without async/await engagement and .NET 4.5 support exclusively)

    And I am quite happy to find Nick Polyak's answers in his codeproject article "Task Parallel Library and async-await Functionality - Patterns of Usage in Easy Samples" stated:

    • "Much of .NET 4.5 functionality has been changed to Tasks and BackgroundWorker is all but obsolete now, but you still might come across some instances when it is necessary to use the EAP pattern. In such cases, it will be nice to produce Task objects out of the EAP functionality so that you'll be able to schedule them to run in parallel or wait for a number of previous Tasks to finish etc. In this section we show how to achieve it"
    • "Having Task functionality made BackgroundWorker functionality largerly obsolete - you can achieve whatever you need using a Task instead of a BackgroundWorker. Still there might be some reason you want to use BackgroundWorker functionality on the team - whether because your legacy code uses it or because most of your team members or your boss love it and understand it better than the newer Task functionality"

    still being open to see any different argumented points of view

提交回复
热议问题