I always create an extension method to export objects to xml with such debugging. This is very useful for troubleshooting data problems with objects. Here is what I use:
public static void SerializeToXML(this object entity) { System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(entity.GetType()); System.IO.StreamWriter file = new System.IO.StreamWriter(string.Format(@"{0}\{1}.xml", Directory.GetCurrentDirectory(), entity.GetType().Name)); writer.Serialize(file, entity); file.Close(); }
This is not 100% complete proof, but most of the time it is perfect. It will create an xml file in the application directory with the object name as the file name. In the next window, you can simply enter the name of the .SerializeToXML () object.
like this: myList.SerializeToXML ()
John Apr 28 '15 at 20:07 2015-04-28 20:07
source share