I have been reading here and here about how to insert a binary array into a varbinary
, but what if I don't have a byte array ready? What if I am serializing an object instead? So if I have
var Formatter = new BinaryFormatter();
Formatter.Serialize(SerializeStream, NewEmployeeTree);
when I want to serialize into a file, I pass SerializeStream
as
var SerializeStream = new FileStream(SelectedPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
but this time I want to serialize into the database. how can I do it?