Queue怎么会存不住对象啦??(在线等待)
//得到一个队列;
private Queue myQueue = new Queue();
private byte[] fileBytes;
if(fileOpener.ShowDialog() == DialogResult.OK)
{
//得到文件流
if((fileStream = fileOpener.OpenFile()) == null)
{
MessageBox.Show("open file failed!!!");
this.dailogWin.Close();
}
//得到byte[]数组的大小;
if(fileStream.Length <1024)
{
this.fileBytes = new Byte[this.fileStream.Length + 8];
}
else
this.fileBytes = new Byte[1032];
while(this.fileStream.Position < this.fileStream.Length)
{
this.main.debuger.richTextBox.AppendText("this.fileStream.position = " + this.fileStream.Position.ToString() + "\r\n");
this.fileBytes[0] = 4;
this.fileBytes[1] = 0;
this.fileStream.Read(this.fileBytes,8,this.fileBytes.Length - 8);
this.main.debuger.richTextBox.AppendText("\r\n");
//压入队列尾部;
this.myQueue.Enqueue(this.fileBytes);
//立刻查看,结果是每次都是刚才压入地数组;
byte[] tempbytes = (byte[])this.myQueue.Peek();
for(int i = 0; i < tempbytes.Length; i++)
this.main.debuger.richTextBox.AppendText(tempbytes[i].ToString());
}
}
不光是以上程序片断,写入文件后也是最后一数组地重复。
请问各位queue怎么会出问题??