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?
Asked
Active
Viewed 3,038 times
1
-
Well what format do you want it to be in? – Jon Skeet Mar 09 '15 at 07:28
-
http://stackoverflow.com/questions/15803215/how-to-convert-any-type-of-object-into-byte-array-in-windows-phone-8 See if this helps. – Vyas Mar 09 '15 at 07:29
-
@JonSkeet I want the dictionary to be in format of byte array[]. I am sorry. I didnt your question exactly – hcnimkar Mar 09 '15 at 07:29
-
That's like saying you want to save an image as bytes - I'm asking the equivalent of jpg, PNG, gif etc but for your dictionary. – Jon Skeet Mar 09 '15 at 07:31
-
@JonSkeet I want to use this byte array to pass it to sha 256 algorithm to encode. So i guess i want the bytes to be utf-8 encoded. I hope it answers the question. – hcnimkar Mar 09 '15 at 07:37
-
@hcnimkar: Are you *just* trying to take a hash for the dictionary? If that's all you need, then you can invent your own format, so long as you control everywhere that's going to do it. But fundamentally a dictionary isn't just a string, so it doesn't make sense to just talk about it being UTF-8-encoded. You could serialize it to JSON and then UTF-8-encode *that*, for example... – Jon Skeet Mar 09 '15 at 08:18