Hi,
I am trying to implement my own formatter that implements and adheres
to the standards of the IFormatter interface. I have run into a bit of
an issue trying to serialize classes that implement the ISerializable
interface. Specifically, I don't know how to repopulate the members
(via the special New constructor). The MSDN documentation for the
FormatterServices.PopulateObjectMembers function claims that:
"if the object implements ISerializable, the populating is handed off
to the object itself. If a matching surrogate is not found, and the
object does not implement the ISerializable interface, then
deserialization populates each field listed in members, with the
corresponding value listed in data."
Based on this, I figure I need to call this method to populate the
data for classes that implement ISerializable. What I can't figure out
is what to pass for the "members()" parameter. It expects an array of
MemberInfo objects, but I can't construct those, the constructor is
protected. I even tried to create my own class that inherits from
MemberInfo, but it just threw an error when I passed it in saying:
"An unhandled exception of type
'System.Runtime.Serialization.SerializationExcepti on' occurred in
mscorlib.dll
Additional information: Only FieldInfo, PropertyInfo, and
SerializationMemberInfo are recognized."
Does anyone have any ideas as to how I can get around this? Does
anyone know what a SerializationMemberInfo is?
Thanks,
Scott.