O
O.B.
I have two classes, Logger and LoggerRuntime. Logger is serializble,
LoggerRuntime is not. LoggerRuntime inherits from Logger. At runtime,
I get a list of LoggerRuntime instances to save to an XML file. I only
want the public attributes of the parent Logger class to get written to
the file. Therefore, I cast the LoggerRuntime objects to "Logger" and
then try to serialize the Logger objects. Instead, I get the following
error:
System.InvalidOperationException: The type
SerializationTest.LoggerRuntime was not expected. Use the XmlInclude or
SoapInclude attribute to specify types that are not known statically.
What am I doing wrong?
LoggerRuntime is not. LoggerRuntime inherits from Logger. At runtime,
I get a list of LoggerRuntime instances to save to an XML file. I only
want the public attributes of the parent Logger class to get written to
the file. Therefore, I cast the LoggerRuntime objects to "Logger" and
then try to serialize the Logger objects. Instead, I get the following
error:
System.InvalidOperationException: The type
SerializationTest.LoggerRuntime was not expected. Use the XmlInclude or
SoapInclude attribute to specify types that are not known statically.
What am I doing wrong?