views:

53

answers:

1

There is a native framework object called HttpBrowserCapabilities. I'd like to Serialize this to XML. Any ideas of the best way to go about it?

My first thought was to create my own class that inherits it then decorate all the properties with XML and then serialize it. I was wondering if there was a simpler (magical) way to do this. :)

TIA

A: 

Unless the class is marked as being serializeable, no. However to achive the above, using a decorator, you can use IDataContractSurrogates. See http://msdn.microsoft.com/en-us/library/system.runtime.serialization.idatacontractsurrogate.aspx

Jaimal Chohan
Ended up creating my own class with [XmlElement} (etc) decorators. Works fine and was not too painful to build.
Keith Barrows