title: How Can I optimize my FTP Download using foreach() and ftpwebrequest?
body: <p>Here is the code that I am using, it will work but the ftp portion of the application is taking around 5 minutes. </p>
  
  <p>The files them selves are not too big, but I would like to optimize the application and I feel like this is the best place to start.</p>
  
  <p>What I try to do is download the 4 particular files. </p>
  
  <p>here are the file sizes: </p>
  
  <p>1 - ~48mb 
  2 - ~856k
  3 - ~25mb
  4 - ~49mb </p>
  
  <pre><code>// BEGIN FTP 
                  WebClient request = new WebClient();
                  request.Credentials =
                         new NetworkCredential(this.userNameRTF.Text,
                                                  this.passRTF.Text);
  
  
                  string[] ftpFile = new string[4];
                  ftpFile[0] = "1";
                  ftpFile[1] = "2";
                  ftpFile[2] = "3";
                  ftpFile[3] = "4"; 
  
  
                  foreach(string s in ftpFile) 
                  {
                      string ftpFileName = s;                        
  
  
                      byte[] fileData =
                              request.DownloadData(this.ftpHost
                                                     + this.ftpPath.Text + ftpFileName);                  
  
                      FileStream file =
                          File.Create(@"\\nas03\customerftp\" + custName.Text + @"\" + ftpFileName);
  
                      file.Write(fileData, 0, fileData.Length);
  
                      file.Close(); 
                  } 
  </code></pre>
  
  <p>Thank you for your help!</p>