public static void SerializeToXML(BountyDataCollection settings, string FolderPath) { string FilePath = Path.Combine(FolderPath, "Cache_Bounties.xml"); var serializer = new XmlSerializer(typeof(BountyDataCollection)); var textWriter = new StreamWriter(FilePath); serializer.Serialize(textWriter, settings); textWriter.Close(); }