Brian Weeres [mailto:[EMAIL PROTECTED]] wrote:

> I am trying to add an additional element in my xml when
> serializing a class using XmlSerializer but I cannot figure
> out how to do it.

I *believe* this can be achieved by using on of the XmlSerializer::Serialize
overloads which take an XmlWriter and writing root node with the XmlWriter
manually... like so:

<codeSnippet language="C#">
XmlWriter writer = new XmlTextWriter(...);
writer.WriteStartDocument();
writer.WriteStartElement("myRootNode");

XmlSerializer serializer = new XmlSerializer(...);
serializer.Serialize(writer, myInstance);

writer.WriteEndElement();
writer.WriteEndDocument();
</codeSnippet>

HTH,
Drew

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to