private static void SerializeValues(string name, string phone, string dateofbirth)
        {
            EmployeeRecords emp = new EmployeeRecords
            {
                Name        = name,
                Phone       = phone,
                DateOfBirth = dateofbirth
            };

            BinaryFormatter bf = new BinaryFormatter();

            FileStream fsout = new FileStream("employee.binary", FileMode.Create, FileAccess.Write, FileShare.None);

            try
            {
                using (fsout)
                {
                    bf.Serialize(fsout, emp);
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine("Exception:- " + Ex.Message);
            }
        }
        private static void DeserializeValues()
        {
            EmployeeRecords emp = new EmployeeRecords();

            BinaryFormatter bf = new BinaryFormatter();

            FileStream fsin = new FileStream("employee.binary", FileMode.Open, FileAccess.Read, FileShare.None);

            try
            {
                using (fsin)
                {
                    emp = (EmployeeRecords)bf.Deserialize(fsin);
                    Console.WriteLine(string.Format("Name:- {0} and Phone:- {1}", emp.Name, emp.Phone));
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine("Exception:- " + Ex.Message);
            }
        }