public static void SerialisoiXml(string tiedosto, CarList autot) { XmlSerializer xs = new XmlSerializer(autot.GetType()); TextWriter tw = new StreamWriter(tiedosto); try { xs.Serialize(tw, autot); } catch (Exception e) { throw e; } finally { tw.Close(); } }