I use MemoryStream to add attachments from a binary file that is stored in the database. My problem is that I want to get rid of MemoryStream correctly. This is easy to do with the βusingβ statement, but when I have several applications, I donβt know how to properly manage multiple MemoryStreams.
Is there a good way to iterate and attach files, but at the same time properly dispose of the MemoryStreams that I use to attach? When I tried to reset / close before using smtp. Send it with an error indicating that the thread is already closed.
Any suggestions would be appreciated.
source share