title: Most memory efficient way to merge two files
body: <p>I need to merge two files while also applying a sort. It is important the I keep the task light on memory usage. I need to create a console app in c# for this.</p>
  
  <p>Input File 1:</p>
  
  <blockquote>
    <p><em>Some Header</em><br>
    A12345334<br>
    A00123445<br>
    A44566555<br>
    B55677<br>
    B55683<br>
    B66489<br>
    <em>record count: 6</em></p>
  </blockquote>
  
  <p>Input File 2:</p>
  
  <blockquote>
    <p><em>Some Header</em><br>
    A00123465<br>
    B99423445<br>
    <em>record count: 2</em></p>
  </blockquote>
  
  <p>So, I need to make sure that the third file should have all the "A" records coming first and then the "B" records followed by the Total record count.</p>
  
  <p>Output File:</p>
  
  <blockquote>
    <p><em>Some header</em><br>
    A12345334<br>
    A00123445<br>
    A44566555<br>
    A00123465<br>
    B99423445<br>
    B55677<br>
    B55683<br>
    B66489<br>
    <em>record count: 8</em></p>
  </blockquote>
  
  <p>Record sorting within "A" and "B" is not relevant.</p>