J
Jesper Denmark
Hi,
I've had a lot of trouble finding a good tutorial showing
deep serialization in XML in C#. All samples I've found
shows merely serialization of a single class. If I want
to serialize members of a class like the 'data' member of
the Person class when I serialize the person object -
which attributes do I need to use?
[XmlRoot("person")]
public class Person
{
[XmlElement("first")]
public string FirstName;
[XmlElement("last")]
public string LastName;
[XmlElement("url")]
public string Url;
//which attributes do I need here
public Data data;
}
//which attributes do I need here
public class Data
{
//which attributes do I need here
public string phone;
}
When browsing the internet I can't find any good
tutorials. All that I find on the subject extends the way
serialization works - There must be some good tutorial
that keeps things simple and shows deep serialization. Do
you know of any?
Best regards Jesper.
I've had a lot of trouble finding a good tutorial showing
deep serialization in XML in C#. All samples I've found
shows merely serialization of a single class. If I want
to serialize members of a class like the 'data' member of
the Person class when I serialize the person object -
which attributes do I need to use?
[XmlRoot("person")]
public class Person
{
[XmlElement("first")]
public string FirstName;
[XmlElement("last")]
public string LastName;
[XmlElement("url")]
public string Url;
//which attributes do I need here
public Data data;
}
//which attributes do I need here
public class Data
{
//which attributes do I need here
public string phone;
}
When browsing the internet I can't find any good
tutorials. All that I find on the subject extends the way
serialization works - There must be some good tutorial
that keeps things simple and shows deep serialization. Do
you know of any?
Best regards Jesper.