I am getting some type IList<object[]> , what is the best way to serialize it to xml.
And then read it back to IList<object[]>.
I just not see any easy way to do so.
Thanks for help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The XmlSerializer chokes on interfaces. So you could convert it to an array or a concrete
List<T>before serializing. Also you should absolutely specify known types because thisobject[]will simply not work. The serializer must know in advance all types that you will be dealing with. This way it will emit type information into the resulting XML:Or if you don’t wanna bother with all this and simply get some human readable persistence for your objects you could use Json:
And if you don’t care about human readability, a binary serializer should do just fine.