I need help to understando this isssue... In this code:
listaVideoTemp = listaVideo;
foreach (var itemVideo in listaVideo)
{
if (itemVideo.ID == id)
{
listaVideoTemp.RemoveAt(i);
listaServidorTemp = listaServidor;
foreach (var itemServidor in listaServidor)
{
listaVideoServidorTemp = itemServidor.PropListaVideo;
foreach (var itemVideoServidor in itemServidor.PropListaVideo)
{
if (itemVideoServidor == id)
listaVideoServidorTemp.RemoveAt(x);
x++;
}
}
}
i++;
}
When execute listaVideoServidorTemp.RemoveAt(x);
the item from itemServidor.PropListaVideo
also is removed.
Can anyone help me?
Exception: Collection has been modified; the enumeration operation may not be performed.
Thanks.