hcnimkar hcnimkar - 17 days ago 5
C# Question

Convert/Serialize Dictionary<string,string> to byte array byte[] in windows phone 8

I am developing applications for windows phone 8. I have dictionary of the format Dictionary. I want to convert this dictionary to byte array. According to this link dictionary can be serialized into byte array using the BinaryFormtter class. However according to this link I cannot use BinaryFormatter in windows phone 8. Is there any workaround method available so that I serialize my Dictionary?

Answer

try

byte[] content = UTF8.GetBytes(UrlEncode(body));
Comments