G
Guest
I'm trying to figure out, from the examples, how to serialize my object to a
String variable so that I can use it to write the serialized object to a
database.
I'd like to use a BinaryFormatter and then do a Convert.ToBase64() or
something to get it into a string that'll be all text and usable in a SQL
query parameter.
But I get confused on two steps:
1. The first parameter of BinaryFormatter.Serialize() is a "stream". Can I
replace that with a string or something that can catch the data that comes
from the Object I pass?
2. How do I do the Convert.ToBase64() before it goes into the string?
So if I have a serializable object named "MyObj"...
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(<what goes here???>, MyObj);
Thanks.
Alex
String variable so that I can use it to write the serialized object to a
database.
I'd like to use a BinaryFormatter and then do a Convert.ToBase64() or
something to get it into a string that'll be all text and usable in a SQL
query parameter.
But I get confused on two steps:
1. The first parameter of BinaryFormatter.Serialize() is a "stream". Can I
replace that with a string or something that can catch the data that comes
from the Object I pass?
2. How do I do the Convert.ToBase64() before it goes into the string?
So if I have a serializable object named "MyObj"...
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(<what goes here???>, MyObj);
Thanks.
Alex