Skip to content

ProtoPromise best practices? #189

Answered by timcassell
drew-512 asked this question in Q&A
Feb 27, 2023 · 1 comments · 18 replies
Discussion options

You must be logged in to vote

Hi Drew,

ProtoPromise should be able to completely replace Task and ValueTask for all async methods that you write.

For any existing APIs that need to work with Task or ValueTask that you do not control, you can convert to/from ProtoPromise by using the task.ToPromise() extensions, or promise.ToTask()/promise.AsValueTask() extensions, as mentioned in the readme https://github.com/timcassell/ProtoPromise#task-interoperability.

but I find the whole ValueTask with async so friggin confusing

Basically, that behaves the same as Task<T>, but is more efficient if the method completed immediately. ProtoPromise has that same optimization built-in.

It's tricky to understand what doesn't generate…

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@timcassell
Comment options

@timcassell
Comment options

@drew-512
Comment options

@timcassell
Comment options

@drew-512
Comment options

Answer selected by timcassell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants