Mime |
public class MimeIterator : IEnumerator<MimeEntity>, IDisposable, IEnumerator
The MimeIterator type exposes the following members.
Name | Description | |
---|---|---|
MimeIterator | Initialize a new instance of the MimeIterator class. |
Name | Description | |
---|---|---|
Current | Get the current entity. | |
Depth | Get the depth of the current entity. | |
Message | Get the top-level message. | |
Parent | Get the parent of the current entity. | |
PathSpecifier | Get the path specifier for the current entity. |
Name | Description | |
---|---|---|
Dispose | Release all resources used by the MimeIterator object. | |
Dispose(Boolean) | Release the unmanaged resources used by the MimeIterator and optionally releases the managed resources. | |
Equals | (Inherited from Object) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations before
the MimeIterator is reclaimed by garbage collection.
(Overrides ObjectFinalize) | |
GetHashCode | (Inherited from Object) | |
GetType | (Inherited from Object) | |
MemberwiseClone | (Inherited from Object) | |
MoveNext | Advance the iterator to the next depth-first entity of the tree structure. | |
MoveTo | Advance to the entity specified by the path specifier. | |
Reset | Reset the iterator to its initial state. | |
ToString | (Inherited from Object) |
var attachments = new List<MimePart> (); var multiparts = new List<Multipart> (); using (var iter = new MimeIterator (message)) { // collect our list of attachments and their parent multiparts while (iter.MoveNext ()) { var multipart = iter.Parent as Multipart; var part = iter.Current as MimePart; if (multipart != null && part != null && part.IsAttachment) { // keep track of each attachment's parent multipart multiparts.Add (multipart); attachments.Add (part); } } } // now remove each attachment from its parent multipart... for (int i = 0; i < attachments.Count; i++) multiparts[i].Remove (attachments[i]);