title: C# WinSCP .NET assembly: How to upload multiple files asynchronously
body: <p>I am using WinSCP .NET assembly for uploading files. I want to upload multiple files asynchronous way. I have created a method but it works as single upload.</p>
  
  <pre><code>public class UploadingData {
  
      private SessionOptions _sessionOptions;
      private Session _session;
  
      //connection etc
  
      private void OnConnected() {
  
          foreach (var fileInfo in localFilesList)
          {
              var task = Task.Factory.StartNew(() =&gt; UploadFilesAsync(fileInfo));
          }
      }
  
      private async Task UploadFilesAsync(string file) {
  
          string remoteFilePath = _session.TranslateLocalPathToRemote(file, @"/", "/test_data_upload");
          var uploading = _session.PutFiles(file, remoteFilePath, false);
  
          //When Done
  
          await Task.Run(() =&gt; Thread.Sleep(1000));
      }
  }
  </code></pre>
  
  <p>Please suggest me correct way. Thanks</p>