Пример #1
0
        public static void SaveCarsXml(string filename, ListOfCars carsToSave)
        {
            Stream stream = File.Open(filename, FileMode.Create);
            DataContractSerializer ser =
                new DataContractSerializer(typeof(ListOfCars));

            ser.WriteObject(stream, carsToSave);
            stream.Close();
        }
Пример #2
0
        public static ListOfCars LoadCarsXml(string filename)
        {
            Stream stream = File.Open(filename, FileMode.Open);
            DataContractSerializer ser =
                new DataContractSerializer(typeof(ListOfCars));
            ListOfCars listOfCars = new ListOfCars();

            listOfCars = (ListOfCars)ser.ReadObject(stream);

            stream.Close();
            return(listOfCars);
        }
Пример #3
0
 public static void SaveCarsXml(string filename, ListOfCars carsToSave)
 {
     Stream stream = File.Open(filename, FileMode.Create);
     DataContractSerializer ser =
         new DataContractSerializer(typeof(ListOfCars));
     ser.WriteObject(stream, carsToSave);
     stream.Close();
 }
Пример #4
0
        public static ListOfCars LoadCarsXml(string filename)
        {
            Stream stream = File.Open(filename, FileMode.Open);
            DataContractSerializer ser =
                new DataContractSerializer(typeof(ListOfCars));
            ListOfCars listOfCars = new ListOfCars();
            listOfCars = (ListOfCars)ser.ReadObject(stream);

            stream.Close();
            return listOfCars;
        }