public static void SerialisoiXml(string tiedosto, Harjoitukset 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(); } }