public static void LogObjectToXML(Object obj, String fileName) { try { XmlSerializer s = new XmlSerializer(obj.GetType()); System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName); s.Serialize(sw, obj); sw.Close(); } catch (Exception) { } }