Can anyone help, I wish to return a asynchronous Stream from asp.net web api and it appears there is more than one way of doing or I don't understand the difference.
For example, you are able to do a PushStreamContent to a standard HttpResponseMessage or it appears you can implement Task and await etc.
What are the differences??
Should I be always returning a stream even for small amounts of data?
Is that is the case should i always be using Async Tasks?
Seems very confusing and I have googled the difference but i can't seem to find a specific answer.
Ultimately it depends what you are trying to do in your case, here is an example of PushStreamContent I found:
Few observations about PushStreamContent that make it valuable in comparison to custom await implementation:
1) It monitors output stream and makes a callback when it is available. 2) It completes the response when output stream closes.
Let us know what you are trying to do, perhaps I can give a more specific answer.