public void LoadJson(Salaries listsalaries, string filepath)
 {
     filepath = @"c:\Windows\temp\SalarieJson.txt";
     using (StreamReader file = File.OpenText(filepath))
     {
         JsonSerializer j = new JsonSerializer();
         this.AddRange(j.Deserialize(file, typeof(Salaries)) as Salaries);
     }
 }
        public void SaveXML(Salaries listsalaries, string filepath)
        {
            filepath = @"c:\Windows\temp\SalarieXML.xml";
            FileStream    fs = File.Create(filepath);
            XmlSerializer x  = new XmlSerializer(typeof(Salaries));

            x.Serialize(fs, listsalaries);
            fs.Close();
            fs.Dispose();
        }
        public void LoadXML(Salaries listsalaries, string filepath)
        {
            filepath = @"c:\Windows\temp\SalarieXML.xml";
            FileStream    fs = File.OpenRead(filepath);
            XmlSerializer x  = new XmlSerializer(typeof(Salaries));

            this.AddRange(x.Deserialize(fs) as Salaries);
            fs.Close();
            fs.Dispose();
        }
        public void SaveBinary(Salaries listsalaries, string filepath)
        {
            filepath = @"c:\Windows\temp\SalarieBinary.dat";
            FileStream      fs = File.Create(filepath);
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(fs, listsalaries);
            fs.Close();
            fs.Dispose();
        }
        public void SaveJson(Salaries listsalaries, string filepath)
        {
            filepath = @"c:\Windows\temp\SalarieJson.json";
            JsonSerializer j = new JsonSerializer();

            using (StreamWriter sw = new StreamWriter(filepath))
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    j.Serialize(writer, listsalaries);
                }
        }