Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

m.kunzendorf

Re: Close session without destroying object

In my case I had to replace an other FTP component in an existing bigger application. Creating new session instances would cause deeper changes in the program flow and application design. Due to time constrains I wanted to avoid this.

But you are right. Creating new session instances has no Performance Impact and from OO perspective, it is the cleaner solution.

Michael
martin

Re: Close session without destroying object

Well, what is a problem about creating a new instance of Session? There is no measurable overhead.
m.kunzendorf

Close session without destroying object

Hi,

I am trying to use the Winscp.net assembly into an existing file transfer program written in vb.net.

I am wondering why no Close method exists inside the Session class to close the current session without disposing the complete object. Sometimes it is useful to close a session and reopen it again with other credentials.

To make some tests I have added a Close method to the source code of the assembly. It looks like this:

public void Close()
{
using (Logger.CreateCallstackAndLock())
{
Cleanup();
}
}

Any comments if this is suitable? Or do you see any bad side effects?

Best,
Michael