This project is read-only.

Moving messages within foreach crashes

Topics: Feature Requests, Help requests, Issues
Feb 18 at 10:45 AM
Edited Feb 18 at 10:46 AM
Collection was modified; enumeration operation may not execute

with this simple code...
(it is part of the code that does not work obviously)
client.Folders["myfolder"].Messages.Download();
MessageCollection messages = client.Folders["myfolder"].Messages;
foreach (ImapX.Message message in messages)
{
    message.MoveTo(client.Folders["anotherfolder"]);
}
there is no workaround because your
MessageCollection has no .toArray() or .count or .size for use in for loop, it would be fine to have something like that for use...

WHY?
how can i do this?