本文介绍了解压缩C#中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码解压缩.gz文件

但出现错误"CopyTo方法不存在"

Hi I am using following code to decompress a .gz file

but getting an error "CopyTo Method does not exist"

private void Decompress(string file)
        {
            FileInfo fi = new FileInfo(file);

            // Get the stream of the source file.
            using (FileStream inFile = fi.OpenRead())
            {
                // Get original file extension, for example
                // "doc" from report.doc.gz.
                string curFile = fi.FullName;
                string origName = curFile.Remove(curFile.Length -
                        fi.Extension.Length);

                //Create the decompressed file.
                using (FileStream outFile = System.IO.File.Create(origName))
                {
                    using (GZipStream Decompress = new GZipStream(inFile,
                            CompressionMode.Decompress))
                    {
                        // Copy the decompression stream
                        // into the output file.
                        <big>Decompress.CopyTo(outFile);</big>                    }
                }
            }
        }



请帮助



please help

推荐答案


这篇关于解压缩C#中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 07:18