title: System.IO.File.ReadAllBytes for file larger than 2GB
body: <p>I have a large file that I need to copy to memory for further processing. The software works fine for files smaller than 2GB, but as soon as they pass this limit I get an exception that ReadAllBytes only supports files smaller than 2GB.</p>
  
  <pre><code>byte[] buffer = System.IO.File.ReadAllBytes(file); // exception if file &gt; 2GB
  </code></pre>
  
  <p><strong>What is the fastest way to copy a file larger than 2GB to memory?</strong></p>
  
  <p>The process is already 64bit and the flag <em>gcAllowVeryLargeObjects</em> is already set.</p>