I have a private instance of a object in a class i wish to include in the
output of class serialization. The object is private because the contents
cannot be modified outside the class but it is important that the contents of
this private member are retained when the class is serialised. Can anyone
tell me how i can include this private object instance into the serialised
output. I know there are a number of xmlattributes you can apply to classes
and class members, but i can't seem to find one that will allow me to do what
i want.

Thanks

Re: Serializing private members of a class by Ben

Ben
Tue Aug 17 08:29:25 CDT 2004

The XmlSerializer does not support the serialization of private members. It
only serializes public fields and read/write properties.

In order to serialize a private member, you must use either a
BinaryFormatter or a SoapFormatter which can be found in the
System.Runtime.Serialization.Formatters.Binary or
System.Runtime.Serialization.Formatters.Soap namespaces, respectively.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"T" <T@discussions.microsoft.com> wrote in message
news:1AC5A166-C95A-4F1C-9F24-DE8101A303B0@microsoft.com...
> I have a private instance of a object in a class i wish to include in the
> output of class serialization. The object is private because the contents
> cannot be modified outside the class but it is important that the contents
of
> this private member are retained when the class is serialised. Can anyone
> tell me how i can include this private object instance into the serialised
> output. I know there are a number of xmlattributes you can apply to
classes
> and class members, but i can't seem to find one that will allow me to do
what
> i want.
>
> Thanks
>