Deserialize generic collections - coming up empty?

If a list is deserialized, the setter is never called. Just the getter. The Deserializer just invokes the #Add() method and adds the serialized elements to the exising List.

This is behaviour by Design. See MSDN You could add a new property wich gets your list without any linq statements. Add an XmlIgnore to your existing property, the XmlSerializer will skip this property now.

If a list is deserialized, the setter is never called. Just the getter. The Deserializer just invokes the #Add() method and adds the serialized elements to the exising List.

This is behaviour by Design. See MSDN. You could add a new property wich gets your list without any linq statements.

Add an XmlIgnore to your existing property, the XmlSerializer will skip this property now. XmlIgnore public List PresentationModules { Create a new property which exposes the list: private List _presentationModules = new List(); public List PresentationModulesList { get { return _presentationModules; } } Your event in the setter of PresentationModules will only be invoked if you assign a NEW list to the property. Maybe you should make the setter private.

OK, this makes sense, but I'm not clear on what my option is to get this resolved. It appears I have to go back and implement a custom serializer/de after modifying my object so it doens't accept a setter for the collection... is that the only option? – AC.

Apr 4 '10 at 10:48 I have updated my answer. Maybe this is what you are want. Is the event which you are invoking in the setter a requirement?

– chriszero Apr 4 '10 at 17:43 Thanks chriszero... got some work to do now... many thanks! – AC. Apr 5 '10 at 11:04.

You can override the serialization and de-serialization methods to add custom information. It's been awhile since I implemented something like this, but I recall having to override to reconstruct some private members from the object upon receiving the serialization data.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions