-3

大家好,我有这样的循环:

for (int i = 0; i < 5; i++)
{
    lock (locker)
    {
        if (passwords.Count == 0)
        {
            proxy_loop = false;
            break;
        }
        else
        {
            password = passwords.Dequeu();
            j++;
        }
    }
}

当循环结束时,我必须恢复密码队列的内容(那是在开头)

4

1 回答 1

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;
于 2013-02-05T00:15:07.050 回答