Save file from a byte[] in C# NET 3.5

后端 未结 5 1701
长发绾君心
长发绾君心 2021-02-04 04:39

My TCP Client receives a image within a packet.The image is compressed with zlib.The task is to decompress the image and put it on the form.

I\'m planning to save the co

5条回答
  •  滥情空心
    2021-02-04 05:08

    In addition to what everyone else has already stated, I would also suggest you use 'using' clauses since all those objects implement IDisposable.

    using(FileStream outFileStream = new ...)
    using(ZOutputStream outZStream = new ...)
    using(FileStream inFileStream = new ...)
    {
        CopyStream(inFileStream, outZStream);
    }
    

提交回复
热议问题