title: Serializing an object and storing it to a varbinary field in a DB
body: <p>I can serialize an object to a file using:</p>
  
  <pre><code>var writeStream = File.Open("l.osl", FileMode.Create);
  var bformatter = new BinaryFormatter();
  bformatter.Serialize(writeStream, l);
  </code></pre>
  
  <p>What I am trying to do is instead of writing it to a file, write it to a DB varbinary field.
  I assume that I have to change writeStream to something else, but what? Can I just put an object in there and there insert that object into the DB (I'm using LINQ).</p>
  
  <p>Will this work?</p>
  
  <p>PS: I have looked around and can't find any solid examples.</p>