The DownloadFile() function requires 3 arguments, but 2 are used absolutely everywhere on the Internet.
And when I also use 2 arguments, I get the following error: No overload for method 'DownloadFile' takes '2' arguments .

Here is an example of use: link

Here is my code:

 using (var sftp = new SftpClient(Host, Port, Username, Password)) { sftp.Connect(); using (var file = File.OpenWrite(LocalDestinationFilename)) { sftp.DownloadFile(RemoteFileName, file); //ошибкатут } sftp.Disconnect(); } 
  • In the library, this is public void DownloadFile (string path, Stream output, Action <ulong> downloadCallback); - Roman
  • 2
    What version are you using? In the library, this is: public void DownloadFile(string path, Stream output, Action<ulong> downloadCallback = null) Ie should and with two let - BOPOH
  • By chance, not on Visual Studio 2008 programming? All that ancient VS 2010 does not understand the optional parameters. - Memoizer
  • try writing instead of the third parameter null xD - kxko

0