Examples

Comments

Update Controls, generic lists and XmlSerializer doesn't work

The Stores variable in the following class does not get xml serialized. Changing IEnumerable to List corrects the problem, but breaks binding. I cannot find a solution short of writting a complete custom serializer. I will have to use INotifyPropertyChanged for these classes if a solution does not exist.

public class Customer
{
private List stores = new List();

private Independent _indStores = new Independent();

public IEnumerable Stores
{
get { _indStores.OnGet(); return stores; }
}
}

public static void SerializeToFile(object theObject, string OutFile)
{
if (theObject == null)
return;

XmlSerializer serializer = new XmlSerializer(theObject.GetType());
StringBuilder sb = new StringBuilder();
using (StringWriter sw = new StringWriter(sb))
{
serializer.Serialize(sw, theObject);
}

File.WriteAllText(OutFile, sb.ToString());
}