Create a program which will execute the next steps:
- Create collection of randomly generated objects in memory by provided models, number of ofjects 10000;
- Serialyze it to JSON format;
- Write the serialization result to the current user desktop directory, the text file name should be "Persons.json";
- Clear the in memory collection;
- Read objects from file;
- Display in console persons count, persons credit card count, the average value of child age.
Use POSIX format for dates. Use lowerCamelCase JSON notation in result file.
Data models:
class Person
{
public Int32 Id { get; set; }
public Guid TransportId { get; set; }
public String FirstName { get; set; }
public String LastName { get; set; }
public Int32 SequenceId { get; set; }
public String[] CreditCardNumbers { get; set; }
public Int32 Age { get; set; }
public String[] Phones { get; set; }
public Int64 BirthDate { get; set; }
public Double Salary { get; set; }
public Boolean IsMarred { get; set; }
public Gender Gender { get; set; }
public Child[] Children { get; set; }
}
class Child
{
public Int32 Id { get; set; }
public String FirstName { get; set; }
public String LastName { get; set; }
public Int64 BirthDate { get; set; }
public Gender Gender { get; set; }
}
enum Gender
{
Male,
Female
}