大家好我有这样的循环:
for (int i = 0; i < 5; i++)
{
lock (locker)
{
if (passwords.Count == 0)
{
proxy_loop = false;
break;
}
else
{
password = passwords.Dequeu();
j++;
}
}
}
当循环结束时,我必须恢复密码Queue
的内容(即开头的内容)答案 0 :(得分:1)
Queue backup = (Queue) passwords.Clone();
for (int i = 0; i < 5; 6++)
{
lock (locker)
{
if (passwords.Count == 0)
{
proxy_loop = false;
break;
}
else
{
string password = (string) passwords.Dequeue();
j++;
}
}
}
passwords = backup;