Mime IteratorGet Ancestor Method
Get an ancestor of the current entity.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The ancestor.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public MimeEntity GetAncestor(
int generation
)Parameters
Return Value
MimeEntityThe ancestor.
Remarks
Gets the ancestor of the current entity that is the specified number of generations above it: a generation of 1 gets the Parent, 2 gets the parent of the parent, and Depth gets the body of the top-level message.
This can be used, for example, to determine whether the current entity is contained within a MultipartAlternative.
Exceptions
| ArgumentOutOfRangeException | generation is less than 1 or greater than Depth. |
| InvalidOperationException | Either MoveNext has not been called or MoveNext has moved beyond the end of the message. |