title: Fast text reading (alternatives to File.ReadAllText() and/or StreamReader.ReadToEnd())
body: <p><strong>Quick-read question</strong>: I was wondering if there'd be other techniques that I overlooked, maybe p/invoke to a certain library (be it winapi or third party library). All advice is welcome.</p>
  
  <p><strong>The full context of the question</strong>:
  For a given usecase I need to read textfiles into memory which I afterwards can manipulate. The problem lies not in the manipulation though but in the I/O. I'm currently using following techniques withing C#:</p>
  
  <p>1) ReadAllText() method of "File"</p>
  
  <pre><code>var content = File.ReadAllText(file.FullName);
  </code></pre>
  
  <p>2) ReadToEnd() method of "StreamReader"</p>
  
  <pre><code>var content = String.Empty;
  using(var streamReader = File.OpenText(file.FullName)) {
      content = streamReader.ReadToEnd();
  }
  </code></pre>
  
  <p>3) I also tried using a <code>BufferedStream</code> in conjunction with method 2</p>
  
  <p>All had roughly the same performance for files between 5 to 20MB. So, <strong>here comes the question then</strong>: I was wondering if there'd be other techniques that I overlooked, maybe p/invoke to a certain library (be it winapi or third party library). All advice is welcome.</p>