Session.Dispose Method

If session was opened, closes it, terminates underlying WinSCP process, deletes XML log file and disposes object.

As opposed to Session.Close, it’s not possible to reuse the object afterwards.



public void Dispose()
Public Sub Dispose()


This method implements IDisposable interface.

When using Session class from C#/VB.NET, it is recommended to use using keyword, instead of calling Dispose directly (most examples here do that).

Though, when using Session class from other languages or through COM interface, you need to call Dispose directly.

Use Session.Close instead, if you want to reuse the object.

Last modified: by martin