What unmanaged resources does it allocates that needs to be disposed? Isn't it just a simple array of managed data? So why disposing?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
A mail message has attachments -> attachments are Streams -> Streams are to be disposed.
Here is the decompiled Dispose method of MailMessage:
As a general rule a class should implement IDisposable if any of its contained children implement it.
A MailMessage can have attachments, an attachment is represented by MIME part which itself holds a Stream. This Stream needs closing as it might hold an unmanaged pointer to the underlying data.