Are there any cases when it's preferable to use a plain old Thread object instead of one of the newer constructs?

前端 未结 10 2220
挽巷
挽巷 2021-01-30 01:45

I see a lot of people in blog posts and here on SO either avoiding or advising against the usage of the Thread class in recent versions of C# (and I mean of course

10条回答
  •  情话喂你
    2021-01-30 02:36

    Task and Thread are different abstractions. If you want to model a thread, the Thread class is still the most appropriate choice. E.g. if you need to interact with the current thread, I don't see any better types for this.

    However, as you point out .NET has added several dedicated abstractions which are preferable over Thread in many cases.

提交回复
热议问题