PowerTCP Mail for .NET
Dispose(Boolean) Method
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Smtp Class > Dispose Method : Dispose(Boolean) Method




disposing
Releases all resources associated with the object.

Syntax

Visual Basic (Declaration) 
Protected Overloads Overrides Sub Dispose( _
   ByVal disposing As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As Smtp
Dim disposing As Boolean
 
instance.Dispose(disposing)
C# 
protected override void Dispose( 
   bool disposing
)
Managed Extensions for C++ 
protected: void Dispose( 
   bool disposing
) override 
C++/CLI 
protected:
void Dispose( 
   bool disposing
) override 

Parameters

disposing

Example

The following example demonstrates closing the Smtp component's connection.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' First check if the Smtp component is connected
If Smtp1.Connected Then
   Try
      ' Try to close gracefully
      Smtp1.Close()
   Catch ex As Exception
      ' If an error occurs here, just abruptly close.
      Smtp1.Dispose()
   End Try
End If
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// First check if the Smtp component is connected
if(smtp1.Connected)
{
   try
   {
      // Try to close gracefully
      smtp1.Close();
   }
   catch(Exception ex)
   {
      // If an error occurs here, just abruptly close.
      smtp1.Dispose();
   }
}

Remarks

The Object.Dispose method abruptly aborts the connection and releases all resources.

Object.Dispose should ONLY be used to release all resources used by the object, and the object should not be used subsequently. If an abort is desired, then Object.Close or Object.Connection.Close if available should be used to terminate activity and reset the object. The Object cannot be used once Object.Dispose or Object.Dispose(true) are called.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.