I have not tried it, but can you just drop it?
serializer(stream, (BaseClass)derived);
Edit
In addition, if you want to have one XmlSerialiser that can handle several derived classes and a base class, then you need to specify all types in the XmlSerialiser constructor.
XmlSerializer serializer = new XmlSerializer(typeof(BaseClass), new Type[] {typeof(DerivedClass)});
Then he will happily serialize several types. However, you will also have to use the solution mentioned above to get the xml output to match between classes.
Leigh s
source share