SftpClient.ListDirectory().ToList() now returns list of (ISftpFile) instead of (SftpFile)
Is this by design?
I just upgraded SSH.Net (via NuGet) to the most current version.
My ListDirectory used to return SftpFile, now returns ISftpFile.
I have worked around this by casting: List<SftpFile> listFileNames = (sftp.ListDirectory("/Outbound/").Cast<SftpFile>()).ToList();
This works, but is the ISftpFile return a bug? Or is this the new-normal?
Thanks.
Bryan Hunt
It's by design. I think it was done to allow people to mock the returned value. The instance that is returned is indeed of type SftpFile. Since SftpFile is sealed, this should not affect performance on (modern) .NET . Why do you cast it to SftpFile?
Gert,
Only because that is what is was in the old version. If ISftpFile will work the same functionally, I can take the cast off.
Thanks.
Bryan