public static void DeSerialisoiXml(string filePath, ref Palauteet palautteet) { XmlSerializer deserializer = new XmlSerializer(typeof(Palauteet)); try { FileStream xmlFile = new FileStream(filePath, FileMode.Open); palautteet = (Palauteet)deserializer.Deserialize(xmlFile); xmlFile.Close(); } catch (Exception ex) { throw ex; } finally { } }
public static void SerialisoiXml(string tiedosto, Palauteet 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(); } }