Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hi I use code below to convert object to byte array now I need this byte array convert back to object. Does any one know how to deserialize this in windows 8 app? I find some code but use Serialize and BinaryReader classes and this classes are not in windows 8 or does not know it.

Person ps = new Person();
        ps.name = "Lucy";

        DataContractSerializer serializer = new DataContractSerializer(typeof(List<Dictionary<String, String>>));

        byte[] byteArr;
        using (var ms = new MemoryStream())
        {
            serializer.WriteObject(ms, ps.name);
            byteArr = ms.ToArray();
        }
        tbByteResult.Text = byteArr.ToString();
share|improve this question
It seem you are supossed to serialize/deserialize an object of type List<Dictionary<String, String>> but you are acually serializing a string – anderZubi Jul 16 at 9:11

1 Answer

up vote 0 down vote accepted

Try:

    using (var ms = new MemoryStream(byteArr))
    {
        var yourObject = serializer.ReadObject(ms);
    }
share|improve this answer
ok this work thanks – user2244495 Jul 16 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.