Ivan Mitev In The Software Trenches

Technology weblog on .NET development and other things that make the world go round

July 01, 2006

XML Serialization

In the recent days I have been trying out .NET XML serialization with the XmlSerializer class. It has a plenty of limitations (such as not supporting Hashtables, serializing only public properties, etc.), so I find it useful only for simple scenarios. There are available other custom-made alternatives as CustomXmlSerializer that look useful. In fact, the default xml serialization can be customized using the interface  IXmlSerializable. Unfortunately the xml serialization that is implemented throughout the codebase makes it hard to work seamlessly with the .NET default serialization. And I guess it is not worth the effort (plus there surely is a little performance penalty using reflection).

2 Comments:

Personally, what really gets me is that you can't do inplace deserialization:

xmlSerializer.Deserialize(xml, objectToDeserializeInt);

By Anonymous Ayende Rahien, at 01 July, 2006 17:24  

I haven't seen a huge hit at all the minimal reflection. It actually depends on what you are doing in reflection that may or may not cause serious performance hits. I don't find basic type checking to be an issue at all.

I recently published a detailed example of how to add custom deserialization/serialization and it is actually isn't that bad once you overcome a few hurdles in understanding what is going on.

The post:
http://paltman.com/archive/2006/07/03/ixmlserializableexample.aspx

By Anonymous Patrick Altman, at 04 July, 2006 05:10  

Post a Comment

<< Home