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

后端 未结 13 2524
悲哀的现实
悲哀的现实 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:56

    MemoryStream has .WriteTo(outstream);

    and .NET 4.0 has .CopyTo on normal stream object.

    .NET 4.0:

    instream.CopyTo(outstream);
    

提交回复
热议问题