I have a string list List<string> mylist
.I have a background operation that adds strings to this list.
i use another background operation to process the strings in this list
foreach (string pfile in mylist)
{
//dostuff
}
This results in this exception
Collection was modified; enumeration operation may not execute
I cannot fetch the full list of files before hitting the loop as a timer operation adds files to the list while the loop is running.How can i get around this problem.Please advice.