各位帮我看看 我写的队列 怎么没法删除首元素啊,谢谢了
public Queue<Image> QueueMethod() //队列
{
Queue<Image> strList = new Queue<Image>();
foreach (var item in getPic(@"E:\pic1"))
{
strList.Enqueue(Image.FromFile(item));
}
return strList;
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image=QueueMethod().First<Image>();
QueueMethod().Dequeue(); //怎么删除不了队列中首元素啊
------解决方案--------------------var imageQueue = QueueMethod();
pictureBox1.Image = imageQueue.First<Image>();
imageQueue.Dequeue();