How to serialize List <T> in Silverlight?

I have a structure called a coordinate that is listed in another class called a segment.

public struct Coordinate
{
    public double Latitude { get; set; }
    public double Longtitude { get; set; }
    public double Altitude { get; set; }
    public DateTime Time { get; set; }
}

public class Segment
{
    private List<Coordinate> coordinates;
    ...
}

I would like to serialize the Segment class using XmlSerializer using Silverlight (on Windows Phone 7). I understand from the link text that XmlSerializer does not support List<T>. What is the recommended way to serialize the coordinates of a mutable array?

Thanks, Jurgen

+3
source share
3 answers

I believe that everyone should always create their own serialization formats. This is a minority opinion these days.

, , .NET.

0

DataContractSerializer XmlSerializer. XmlSerializer Silverlight, DataContractSerializer.

, .

+2

You tried? Which bit does not specifically offer lists?

For information, as soon as I have all the tools together (VS2010 / Phone 7 sdk, etc.), I plan to see what protobuf-net can do for phone 7, but XmlSerializershould be solid by default.

+1
source

Source: https://habr.com/ru/post/1742031/


All Articles