Multiple emails and attachments, reusing memory stream I am generating a pdf form based on user input from an MVC website form. The pdf is genrated using the Foxit .NET SDK, then attached to three separate emails, generated using Postal. It has been requested that the file not be saved to disk at any stage.

I have not worked a lot with files or MemoryStreams before so would just like to know if my code is following the standard practices for managing memory and performance etc.

MergeDocument document = new MergeDocument(); // The PDF File Object
// ... Populate and create the pdf file

// Generate and Send the emails
// To the user
dynamic useremail = new Email("FormSubmitted");
useremail.To = User.EmailAddress;
useremail.Attach(new Attachment(new MemoryStream(document.Draw()), "OrderForm.pdf"));
useremail.Send();

// To the Vendor
dynamic vendoremail = new Email("FormSubmittedVendor");
vendoremail.To = Vendor.EmailAddress;
vendoremail.Attach(new Attachment(new MemoryStream(document.Draw()), "OrderForm.pdf"));
vendoremail.Send();

// To us
dynamic internalemail = new Email("FormSumbittedUs"); // To: is hardcoded in view.
internalemail.Attach(new Attachment(new MemoryStream(document.Draw()), "OrderForm.pdf"));
internalemail.Send();


Is it ok to create new MemoryStream objects for each email?
Basically it is ok, to create a new MemoryStream 3 times, but I have to ask, why you don't create one Attachment adding it to each of the emails like so  

var attachment = new Attachment(new MemoryStream(document.Draw()), "OrderForm.pdf");  
useremail.Attach(attachment);
vendoremail.Attach(attachment);
internalemail.Attach(attachment);