jstedfast / MimeKit

A .NET MIME creation and parser library with support for S/MIME, PGP, DKIM, TNEF and Unix mbox spools.
http://www.mimekit.net
MIT License
1.79k stars 360 forks source link

Will the order of the `MimeMessage.Attachments` (i.e., `MimeMessage.EnumerateMimeParts`) enumeration be permanent? #1021

Closed fyodorklimenko closed 3 months ago

fyodorklimenko commented 3 months ago

Dear Mr. Stedfast, Thank you for your effort and the fantastic library!

I want to use the index of the MimeMessage.Attachments (src) element as a unique identifier for attachments within the scope of a single MIME message.

As a result, a change in the EnumerateMimeParts method (src) may break the logic of my project.

Can I be sure that the enumeration of attachments will ALWAYS be from top to bottom? Is the order of the enumeration a part of the method contract?

jstedfast commented 3 months ago

Yes, the MimeMessage.Attachments implementation will always use a depth-first approach.