| MimeIteratorCurrent Property |
Get the current entity.
Namespace: MimeKitAssembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax Exceptions Remarks
After an iterator is created or after the
Reset method is called,
the
MoveNext method must be called to advance the iterator to the
first entity of the message before reading the value of the Current property;
otherwise, Current throws a
InvalidOperationException. Current
also throws a
InvalidOperationException if the last call to
MoveNext returned false, which indicates the end of the message.
Example var 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