title: c# string Trim() method: how to get the spaces/escape characters which were trimmed out?
body: <p>I'm trying to use the string.Trim() function in C# when reading an XML file, which is formatted with indents. I use it to trim each line (get rid of spaces/tabs before the tag) so that I can analyze just the tag in my loop conditions. I want to print the whole line including the spaces into a listbox. I have figured out a way to do it (just take the string of the line itself and print) but I was wondering if I would be able to print the trimmed out spaces, then print the string of just the tag. Is there a string function which retains what is trimmed out and allows me to use it again?</p>
  
  <p>Edit: in response to if I am reading it as plain text (don't really know if I am..) this is the code which reads the XML file and writes it into listbox 1. I am writing certain parts of it into listbox 2</p>
  
  <pre><code>string line;
  System.IO.StreamReader file = newSystem.IO.StreamReader(@"directorylocation");
  while ((line = file.ReadLine()) != null)
  {listBox1.Items.Add(line);}
  file.Close();
  </code></pre>