[DataContract]
public class A : List<B>
{
[DataMember]
public double TestA { get; set; }
}
[DataContract]
public class B
{
[DataMember]
public double TestB { get; set; }
}
With the model above I try to serialize the following object:
List<A> list = new List<A>()
{
new A() { TestA = 1 },
new A() { TestA = 3 }
};
json = JsonConvert.SerializeObject(list);
//json: [[],[]]
Where are my two values from TestA
?
It's possible duplicate from this thread (XML), but I want to know if there is no option to include those values by setting some JSON serialize option?
Note: Creating a property List<B>
in class A
instead of inheritance is no option for me.