System.Net.Mail.MailMessage.Dispose Method

Releases all resources used by the System.Net.Mail.MailMessage.

Syntax

public void Dispose ()

Remarks

Call the MailMessage.Dispose method when you are finished using the System.Net.Mail.MailMessage. The MailMessage.Dispose method leaves the System.Net.Mail.MailMessage in an unusable state. After calling MailMessage.Dispose, you must release all references to the System.Net.Mail.MailMessage so the garbage collector can reclaim the memory that the System.Net.Mail.MailMessage was occupying. For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

Note:

Always call MailMessage.Dispose before you release your last reference to the System.Net.Mail.MailMessage.

Requirements

Namespace: System.Net.Mail
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0