public static void save(Object ob, String filename) { //this creates an XML writer, which will be used to serialize an object to XML XmlTextWriter writer = new XmlTextWriter(filename, null); //this creates the WOX writer ObjectWriter woxWriter = new SimpleWriter(); //writes the object to XML woxWriter.write(ob, writer); writer.Close(); Console.Out.WriteLine("Saved object to " + filename); }