I have two types of classes:
public class HolidayClass
{
public int ID { get; set; }
public string Name { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public bool Active { get; set; }
public HolidayClass(int ID, string Name, DateTime StartDate, DateTime EndDate, bool Active)
{
this.ID = ID;
this.Name = Name;
this.StartDate = StartDate;
this.EndDate = EndDate;
this.Active = Active;
}
public HolidayClass()
{
}
}
public class ProjectClass
{
public int ID { get; set; }
public string NetsisID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public bool Active { get; set; }
public ProjectClass(int ID, string NetsisID, string Name, string Address, bool Active)
{
this.ID = ID;
this.NetsisID = NetsisID;
this.Name = Name;
this.Address = Address;
this.Active = Active;
}
public ProjectClass()
{
}
}
and then I have two list items.
List<ProjectClass> pc;
List<HolidayClass> hc;
I can serialize a single list with:
myJson = new JavaScriptSerializer().Serialize(pc).ToString();
or
myJson = new JavaScriptSerializer().Serialize(hc).ToString();
I want to serialize these two lists on the same json line. How to do it?
source
share