Trim string completely
<p>I am using the following code to fetch the output of <code>FtpWebRequest</code> and then parse the lines one by one.</p>

<pre><code>FTPEntity entity = new FTPEntity(entityName);
entities.Add(entity);
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(textBoxFTPSite.Text + entityName);
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
request.Credentials = new NetworkCredential(textBoxFTPUserName.Text, textBoxFTPPassword.Text);
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
string[] outputlines = reader.ReadToEnd().Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
foreach (string info in outputlines) {
  if (info == "") {
    worker.ReportProgress(1);
    continue;
  }
  var tokens = info.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
}
</code></pre>

<p>Since there is nothing in that FTP directory, the output of <code>ReadToEnd()</code> is blank. But still the Split function is creating an array of one blank element and I had to use an <code>if</code> statement to filter that one out.</p>

<p>Why is <code>Trim()</code> not trimming completely?</p>
