Add a new console application project named WorkingWithSerialization.
To show a common example, we will define a custom class to store information about a person and then create an object graph using a list of Person instances with nesting.
Add a class named Person with the following definition. Notice that the Salary property is protected, meaning it is only accessible to itself and derived classes. To populate the salary, the class has a constructor with a single parameter to set the initial salary:
using System; using System.Collections.Generic; namespace Packt.CS7 { public class Person { public Person(decimal initialSalary) { Salary = initialSalary; } public string FirstName { get; set; } public string LastName { ...