You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 16, 2022. It is now read-only.
[DataContract]
public class BaseModel
{
public BaseModel()
{
Name = "BaseModel";
}
[DataMember]
public string Name { get; set; }
}
[DataContract]
public class OneModel :BaseModel
{
public OneModel()
{
Name = "OneModel";
}
public List<BaseModel> OneItems { get; set; } = new List<BaseModel>(new BaseModel[] { new BaseModel() { Name = "One" }, new BaseModel() { Name = "Two" } });
}
[DataContract]
public class TwoModel : OneModel
{
public TwoModel()
{
Name = "TwoModel";
}
[DataMember]
public List<BaseModel> Items { get; set; } = new List<BaseModel>(new BaseModel[] { new BaseModel() { Name = "One BaseModel" }, new OneModel() { Name = "Two OneModel" } });
}
Example:
Converting to JSON
We get the following:
and it should be the following JSON:
The text was updated successfully, but these errors were encountered: