C
coder316
Hello,
I have the following method to serialize a dictionay:
string x = SerializePicks(DictionaryOfTeams);
private string SerializePicks(Dictionary<int, string[]>
DictionaryOfTeams)
{
BinaryFormatter formatter = new BinaryFormatter();
Stream stre = new MemoryStream();
formatter.Serialize(stre, DictionaryOfTeams);
char[] buf = new char[stre.Length];
StreamReader reader = new StreamReader(stre);
stre.Seek(0, SeekOrigin.Begin);
string text;
return text = reader.ReadToEnd();
}
Then I insert it into a Db:
InsertPicks(x, currentUser.ProviderUserKey.ToString(), region);
This works
Now I query the db and get the string representaion on the serialized
Dictionary.
"?????System.Collections.Generic.Dictionary`2[[System.Int32,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561........................."
I want to Deserialize this back into my dictionary, but needless to
say I'm stuck.
Any help is greatly appreciated
Thanks
I have the following method to serialize a dictionay:
string x = SerializePicks(DictionaryOfTeams);
private string SerializePicks(Dictionary<int, string[]>
DictionaryOfTeams)
{
BinaryFormatter formatter = new BinaryFormatter();
Stream stre = new MemoryStream();
formatter.Serialize(stre, DictionaryOfTeams);
char[] buf = new char[stre.Length];
StreamReader reader = new StreamReader(stre);
stre.Seek(0, SeekOrigin.Begin);
string text;
return text = reader.ReadToEnd();
}
Then I insert it into a Db:
InsertPicks(x, currentUser.ProviderUserKey.ToString(), region);
This works
Now I query the db and get the string representaion on the serialized
Dictionary.
"?????System.Collections.Generic.Dictionary`2[[System.Int32,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561........................."
I want to Deserialize this back into my dictionary, but needless to
say I'm stuck.
Any help is greatly appreciated
Thanks