How do I copy the contents of one stream to another?

后端 未结 13 2357
悲哀的现实
悲哀的现实 2020-11-21 22:11

What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?

13条回答
  •  忘了有多久
    2020-11-21 22:43

    Easy and safe - make new stream from original source:

        MemoryStream source = new MemoryStream(byteArray);
        MemoryStream copy = new MemoryStream(byteArray);
    

提交回复
热议问题