By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,153 Members | 995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,153 IT Pros & Developers. It's quick & easy.

XmlSerializer--return fragment only without leading<?xml version="

P: n/a

I'm trying to emulate the userSettings storage system on CE.

XmlSerialization looks like a very useful 1-line solution that looks
wonderful for serializing one class to one xml document -- but not an xml
string fragment...

Because that user.config often has more than just class serialized into
(such as one per assembly if each assembly has a Settings.settings file). An
example would be this:
<?xml version="1.0" encoding="utf-8"?>

Some Notes I want to keep , etc.

<setting name="MyUserSetting2" serializeAs="String">
<setting name="MyUserSetting" serializeAs="String">
<setting name="MoreSettings" serializeAs="String">
<setting name="MoreSettings2" serializeAs="String">
How can I force the XmlSerializer to return everything minus the leading
<?xml version="1.0" encoding="utf-8"?up front, so that I can stringbuild
several classes together before saving it?

BTW: I see one overload that allows for multiple types to be given, but I
don't think that's what I want -- because user.settings may contain other
fragments, notes, etc, so I don't want to give over to the XmlSerializer
complete control of the file (it will erase the notes, etc.).

Or is there a better approach to this?

Thank you very much,

it appears to create a full xml document, rather than just a string fragment.
Jul 31 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.