Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

but shouldnt it be that ValueTask is used everywhere by default and class "exists for some usecase"?


If you know that an operation will not complete sychronously (e.g. because it requires a network transaction) then normal Task might actually be more efficient, because the heap allocation would be required anyway and you safe the additional branches.


It kind of depends. Class is safer because you can have multiple calls to await and the TPL was designed to be mostly as safe as possible by default....but yeah, it does hurt that its not alloc free.


Should: yes. Can: no. Why: backward compatibility




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: