A
Andrew Robinson
I need to serialize a dictionary so I can encode the contents. I have the
following working but the size seems large. I am guessing that I am
serializing the entire object not just the data. Is there a better way?
MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("name", "andrew");
dictionary.Add("home", "bellingham");
formatter.Serialize(stream, dictionary);
byte[] b = stream.ToArray();
How do I use "dictionary.GetObjectData()" ?
Thanks,
following working but the size seems large. I am guessing that I am
serializing the entire object not just the data. Is there a better way?
MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("name", "andrew");
dictionary.Add("home", "bellingham");
formatter.Serialize(stream, dictionary);
byte[] b = stream.ToArray();
How do I use "dictionary.GetObjectData()" ?
Thanks,