예제 #1
0
        public static void DeSerialisoiXml(string filePath, ref AutoLista leffat)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(AutoLista));
            try
            {

                FileStream xmlFile = new FileStream(filePath, FileMode.Open);
                leffat = (AutoLista)deserializer.Deserialize(xmlFile);
                xmlFile.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }
예제 #2
0
 public static void SerialisoiXml(string tiedosto, AutoLista ic)
 {
     XmlSerializer xs = new XmlSerializer(ic.GetType());
     TextWriter tw = new StreamWriter(tiedosto);
     try
     {
         xs.Serialize(tw, ic);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         tw.Close();
     }
 }