Mime Iterator Class
An iterator for a MIME tree structure.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public class MimeIterator : IEnumerator<MimeEntity>,
IEnumerator, IDisposable- Inheritance
- Object MimeIterator
- Implements
- IEnumeratorMimeEntity, IEnumerator, IDisposable
Remarks
Walks the MIME tree structure of a MimeMessage in depth-first order.
Example
C#
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]);
Constructors
| MimeIterator | Initialize a new instance of the MimeIterator class. |
Properties
| Current | Get the current entity. |
| CurrentMessage | Get the message that contains the current entity. |
| Depth | Get the depth of the current entity. |
| Index | Get the index of the current entity within its parent multipart. |
| Message | Get the top-level message. |
| Parent | Get the parent of the current entity. |
| PathSpecifier | Get the path specifier for the current entity. |
Methods
| 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 | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| GetAncestor | Get an ancestor of the current entity. |
| GetEnumerator | Get the enumerator. |
| GetHashCode | Serves as the default hash function. (Inherited from Object) |
| GetType | Gets the Type of the current instance. (Inherited from Object) |
| MemberwiseClone | Creates a shallow copy of the current Object. (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. |
| SkipChildren | Skip the descendants of the current entity. |
| ToString | Returns a string that represents the current object. (Inherited from Object) |