Hi!
Ich hab ein Problem und einen Knoten im Kopf :
Ich hab eine selbsterstellte Document-Klasse, die nochmal ein paar selbsterstellte Klassen enthält.
Immer wenn ich die Document-Instanz serialisieren will kommt eine Fehlermeldung:
Ich hab schonmal eigene Klassen (nur nicht so komplexe) serialisiert und es ging...
Warum geht's hier nicht?
thx
Marius
Ich hab ein Problem und einen Knoten im Kopf :
Ich hab eine selbsterstellte Document-Klasse, die nochmal ein paar selbsterstellte Klassen enthält.
Immer wenn ich die Document-Instanz serialisieren will kommt eine Fehlermeldung:
Eine nicht behandelte Ausnahme des Typs 'System.InvalidOperationException' ist in system.xml.dll aufgetreten.
Zusätzliche Informationen: Fehler beim Reflektieren des Typs 'Fireworx.PowerDraw.ObjectManagement.DocumentLayer'.
Code:
[XmlInclude(typeof(Document)),
XmlInclude(typeof(DocumentLayer)),
XmlInclude(typeof(Layer)),
XmlInclude(typeof(PowerDrawKeyList)),
XmlInclude(typeof(GraphicalCircle)),
XmlInclude(typeof(GraphicalLine)),
XmlInclude(typeof(GraphicalRectangle)),
XmlInclude(typeof(GraphicalText)),
XmlInclude(typeof(GraphicalTriangle))]
private void mniFileSaveAs_Click(object sender, System.EventArgs e)
{
Type[] Types = new Type[]{typeof(DocumentLayer),
typeof(Layer), typeof(PowerDrawKeyList),
typeof(GraphicalCircle),
typeof(GraphicalLine),
typeof(GraphicalRectangle),
typeof(GraphicalText),
typeof(GraphicalTriangle)};
XmlTextWriter tw = new XmlTextWriter("TestFile.xml", null);
XmlSerializer ser = new XmlSerializer(Document.GetType(), Types); //<-- Hier gibt's die Fehlermeldung
ser.Serialize(tw, Document);
tw.Close();
}
Ich hab schonmal eigene Klassen (nur nicht so komplexe) serialisiert und es ging...
Warum geht's hier nicht?
thx
Marius