|
|
Question : .Net XML Serialization of complex objects
|
|
|
|
This question involves the approach for handling XML serialzation of complex objects.
I've got a pretty complicated object which contains other embedded objects and lists of embedded objects. My class is new, but it includes references to several (nested) legacy objects/classes.
I need to be able to save the structure to a state from which I can easily reinitialize the object on demand. (Think the case of where you're on a web form, navigate off, and then return to the form).
I know there's an XMLSerializer class available. It seems to work well for fairly flat/simple structures. I pretty sure that it's not going to work for what I need to do.
An example illustration looks like this: -----------------------------------------------
Externally defined classes which contain references to several other embedded legacy classes:
FooBar FooBoo
// Class to be serialized. Public Class Foo { public int X { get; set;} public int Y { get; set;} public int Z { get; set;}
public int A { get; } public int B { get; }
public FooBar { get { return _fooBar; } }
private List<KeyValuePair<int, FooBoo>> _listOfFooBoo; public IEnumerable<FooBoo> ListOfFooBoo { get { return _listOfFooBoo.Select(x => x.Value).ToList(); } }
}
What's the best approach to use here?
Thanks, JohnB
|
|
|
|
Answer : .Net XML Serialization of complex objects
|
|
|
|
|
|
|
|
|