0

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.

Matt
  • 25,943
  • 66
  • 198
  • 303
  • Possible duplicate of [Storing C# data structure into a SQL database](https://stackoverflow.com/questions/217187/storing-c-sharp-data-structure-into-a-sql-database) – Andrew Diamond Mar 18 '19 at 15:37

1 Answers1

1

Kind of close to this:

Storing C# data structure into a SQL database

Community
  • 1
  • 1
BigBlondeViking
  • 3,853
  • 1
  • 32
  • 28