0

I've got such a class:

public class ProfileElementList : ObservableCollection<ProfileElement>
{
    public string BezierCurve { get; set; }
    public string BezierCurveLimit { get; set; }
}

It is serialized fine, except BezierCurve and BezierCurveLimit are not present in XML.

What should I do to have them?

Danil
  • 511
  • 5
  • 5
  • 2
    How are you serializing the data? – Yuval Itzchakov Jun 05 '15 at 15:14
  • What are the definitions of `BezierCurve` and `BezierCurveLimit`? – Ron Beyer Jun 05 '15 at 15:29
  • Check parent class and make sure object are public. Only public variables get serialized. The child class object will be ignored if the parent(s) aren't public. – jdweng Jun 05 '15 at 16:22
  • 1
    If you are using [`XmlSerializer`](https://msdn.microsoft.com/en-us/library/58a18dwa%28v=vs.110%29.aspx), then this is a duplicate of http://stackoverflow.com/questions/5069099/when-a-class-is-inherited-from-list-xmlserializer-doesnt-serialize-other-att. – dbc Jun 06 '15 at 00:43
  • Another duplicate: http://stackoverflow.com/questions/12660515/why-doesnt-this-class-property-serialize – dbc Jun 06 '15 at 00:46
  • I think you are right – Danil Jun 24 '16 at 14:32

1 Answers1

0

Ok, I did it like this:

    public class ProfileElementList
{
    public ProfileElementList() { }
    public ObservableCollection<ProfileElement> ProfileElements = new ObservableCollection<ProfileElement>();
    public BezierViewModel BezierCurve { get; set; }
    public BezierViewModel BezierCurveLimit { get; set; }
}

It works

Danil
  • 511
  • 5
  • 5