I want to serialize objects to text, but I want to preserve the type info so that I may deserialize without a reference to the type object.
XML Serialization gives me the text I want, but does not keep the type info. What I've read about binary serialization is that it keeps the type info, but its not readable. Looks like the SoapFormater may do what I want, but I'm not sure if this is appropriate.
My goal is to stick the serialized string into a string object, which eventual gets stored in a column in the database (this outside of my control at the moment).
For example, I have a base class:
public class PluginSettings
{
private string name;
public string Name { ... }
}
and each plugin can derive from this to save its own settings.
public class ACBPluginSettings : PluginSettings
{
private string mySetting;
...
}
Possible solution I came up with: Use BinaryFormatter, then convert to Base64 string. This gets the job done but its not human readable.