Recent comments
- No longer preferred
3 years 13 weeks ago - Is this still the preferred way?
3 years 19 weeks ago - Wrong. When replacing the
3 years 44 weeks ago - Very nice
3 years 46 weeks ago - Example Application
3 years 47 weeks ago - Responsibilities
4 years 3 days ago - Menus
4 years 3 days ago - The reason that this is a
4 years 17 weeks ago - You need to explain why these
4 years 17 weeks ago - RE: I like your approach, but ...
4 years 21 weeks ago
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 stores = new List();
{
private 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());
}