views:

218

answers:

1

I can serialize an object to a file using:

var writeStream = File.Open("l.osl", FileMode.Create);
var bformatter = new BinaryFormatter();
bformatter.Serialize(writeStream, l);

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).

Will this work?

PS: I have looked around and can't find any solid examples.