title: How do I write raw data from any data type to a file with C#?
body: <p>I'm writing a Windows app in C#. I have a custom data type that I need to write as raw data to a <em>binary</em> file (not text/string based), and then open that file later back into that custom data type.</p>
  
  <p>For example:</p>
  
  <pre><code>Matrix&lt;float&gt; dbDescs = ConcatDescriptors(dbDescsList);
  </code></pre>
  
  <p>I need to save <code>dbDescs</code> to file blah.xyz and then restore it as <code>Matrix&lt;float&gt;</code> later. Anyone have any examples? Thanks!</p>