title: Alternative to ReadLine?
body: <p>I'm trying to read some files with <code>ReadLine</code>, but my file have some break lines that I need to catch (not all of them), and I don't know how to get them in the same array, neither in any other array with these separators... because... <code>ReadLine</code> reads lines, and break these lines, huh?</p>
  
  <p>I can't replace these because I need to check it after the process, so I need to get the breaklines AND the content after that. That's the problem. How can I do that?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public class ReadFile
  {
      string extension;
      string filename;
      System.IO.StreamReader sr;
  
      public ReadFile(string arquivo, System.IO.StreamReader sr)
      {
          string ext = Path.GetExtension(arquivo);
  
          sr = new StreamReader(arquivo, System.Text.Encoding.Default);
  
          this.sr = sr;
          this.extension = ext;
          this.filename = Path.GetFileNameWithoutExtension(arquivo);
  
          if (ext.Equals(".EXP", StringComparison.OrdinalIgnoreCase))
          {
              ReadEXP(arquivo);
          }
          else MessageBox.Show("Extensão de arquivo não suportada: "+ext);
  
      }
  
      public void ReadEXP(string arquivo)
      {
  
          string line = sr.ReadLine();
  
          string[] words;
          string[] Separators = new string[] { "&lt;Segment&gt;", "&lt;/Segment&gt;", "&lt;Source&gt;", "&lt;/Source&gt;", "&lt;Target&gt;", "&lt;/Target&gt;" };
  
          string ID = null;
          string Source = null;
          string Target = null;
  
          DataBase db = new DataBase();
          //db.CreateTable_EXP(filename);
          db.CreateTable_EXP();
  
          while ((line = sr.ReadLine()) != null)
          {
  
              try
              {
  
                  if (line.Contains("&lt;Segment&gt;"))
                  {
                      ID = "";
                      words = line.Split(Separators, StringSplitOptions.None);
                      ID = words[0];
                      for (int i = 1; i &lt; words.Length; i++ )
                          ID += words[i];
                      MessageBox.Show("Segment[" + words.Length + "]: " + ID);
                  }
                  if (line.Contains("&lt;Source&gt;"))
                  {
                      Source = "";
                      words = line.Split(Separators, StringSplitOptions.None);
                      Source = words[0];
                      for (int i = 1; i &lt; words.Length; i++)
                          Source += words[i];
                      MessageBox.Show("Source[" + words.Length + "]: " + Source);
                  }
                  if (line.Contains("&lt;Target&gt;"))
                  {
                      Target = "";
                      words = line.Split(Separators, StringSplitOptions.None);
                      Target = words[0];
                      for (int i = 1; i &lt; words.Length; i++)
                          Target += words[i];
                      MessageBox.Show("Target[" + words.Length + "]: " + Target);
  
                      db.PopulateTable_EXP(ID, Source, Target);
  
                      MessageBox.Show("ID: " + ID + "\nSource: " + Source + "\nTarget: " + Target);
                  }
  
              }
              catch (IndexOutOfRangeException e)
              {
                  MessageBox.Show(e.Message.ToString());
                  MessageBox.Show("ID: " + ID + "\nSource: " + Source + "\nTarget: " + Target);
              }
  
          }
  
          return;
      }
  </code></pre>