It's sad, but you can't use the XmlSerializer for this. the only easy/good
alternative I know of is to use the SoapFormatter:
NameValueCollection values = new NameValueCollection();
values.Add("one", "two");
values.Add("a", "b");
SoapFormatter ser = new SoapFormatter();
MemoryStream ms = new MemoryStream();
ser.Serialize(ms, values);
byte[] b = ms.GetBuffer();
string s = Encoding.Default.GetString(b);
ms.Close();
you'll need to add a reference to
System.Runtime.Serialization.Formatters.Soap.dll
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mike Logan" <Mi*******@community.nospam> wrote in message
news:24**********************************@microsof t.com...
We are trying to serialize the Request.ServerVariables collection
(NameValueCollection) to an XML formatted string, to insert into a
database. The problem we are running into is that most of the example that we find
discuss writing to a file. Does anyone have a simple function to do this?
We would also like to deserialize the string from the database back into a
NameValueCollection.
--
Mike Logan