When to use byte array, and when to use stream?
问题 I need to send images and small video files (around 5MB, less than 10MB) to a REST service, which I will write. I am wondering whether I should use Byte[] or Stream to accomplish this task. What would be the dividing line in terms of transfer file size between using Byte[] and Stream? 回答1: The amount of free memory you're willing to commit to the transaction is your only real constraint. If you have a 5M file, then you'll need to load the entire thing in to RAM, which will cost 5M. If you