title: Decode large Base64 strings
body: <p>I have an input string from a WebService in the form of a roughly 70 MB large base64-encoded string.</p>
  
  <p>I want to decode this into a file, and tried the obvious: using <code>Convert.FromBase64String()</code>.</p>
  
  <p>This, however, yields a <code>OutOfMemoryException</code>. After some reading, I discovered that the <code>Convert</code> methods concerned with Base64</p>
  
  <blockquote>
    <p>leak memory (no doubt due to the immutable nature of strings and some poor design inside the framework methods)
    <em><a href="http://www.tribridge.com/knowledge-center/tribridge/posts/p2/2011/04/29/solving-outofmemoryexception-errors-when-attempting-to-attach-large-base64-encoded-content-into-crm-annotations" rel="nofollow">source</a></em></p>
  </blockquote>
  
  <p>and there is a handy "streamed" replacement in the <code>System.Security.Cryptography</code> namespace: <code>FromBase64Transform</code>.</p>
  
  <p>So, I decided to give that a try, but I need to input the method an array of <code>byte</code>s, which I don't have - I have a string.</p>
  
  <p>How can I convert the <code>string</code> I have into <code>byte</code>s without running into another <code>OutOfMemoryException</code> on <em>that</em> transformation again?</p>