关于byte数组问题请大家指点

图片说明

虽然我给byte分配了很多空间,但是,每次取的数值只有七万多,这是怎么回事呢

这个流中只有这么多字节,所以只能读取这么多。stream哪里来的。

你这个复制图片么,首先你得while条件 就感觉有问题。没怎么做过c#,但是感觉代码怪怪的

        Stream stream;
            try
            {
                response = (HttpWebResponse)request.GetResponse();
                stream = response.GetResponseStream();
            }
            catch (Exception)
            {
                throw;
            }
            pBar.Properties.Minimum = 0;

            pBar.Properties.Maximum = Convert.ToInt32(Common.totleSize);
            int buffer = 1024000;
            byte[] bytes=new byte[buffer];
            nReadSize = stream.Read(bytes, 0, buffer);

            while (nReadSize > 0)
            {
                fs.Write(bytes, 0, nReadSize);         
                nReadSize = stream.Read(bytes, 0,buffer);
                nowCount = nReadSize + nowCount;

                           }

                                                        Stream是我声明的,可是不仅仅有七万多,还有很多了,但是每次循环只能读取七万多,很奇怪,请大家指点指点吧