 | MimeIteratorMoveNext Method |
Advance the iterator to the next depth-first entity of the tree structure.
Namespace: MimeKitAssembly: MimeKit (in MimeKit.dll) Version: 4.10.0
Syntax
Remarks
After an iterator is created or after the
Reset method is called,
an iterator is positioned before the first entity of the message, and the first
call to the MoveNext method moves the iterator to the first entity of the message.
If MoveNext advances beyond the last entity of the message, MoveNext returns false.
When the iterator is at this position, subsequent calls to MoveNext also return
false until
Reset is called.
Examplevar attachments = new List<MimePart> ();
var multiparts = new List<Multipart> ();
using (var iter = new MimeIterator (message)) {
while (iter.MoveNext ()) {
var multipart = iter.Parent as Multipart;
var part = iter.Current as MimePart;
if (multipart != null && part != null && part.IsAttachment) {
multiparts.Add (multipart);
attachments.Add (part);
}
}
}
for (int i = 0; i < attachments.Count; i++)
multiparts[i].Remove (attachments[i]);
See Also