Unable to save layout

I am trying to serialize and deserialize a model which is GraphLinksModel(Distribution N/w Node and Universal Link Data) into an XML file because I need to save a layout of the model if user changes makes any change.
When I am trying to do the same, I am getting an exception that interface cannot be serialized. Is there any other way to resolve this?

I can’t help you unless you provide more relevant information. What code did you call to do the serialization (did you call model.Save)? What was the error message? What are the outlines of your Model and data classes? How does your code compare to the many examples of XML serialization that the samples use?

Hi Walter, sorry for not giving you enough information. I am not calling mode.Save, instead I am trying to serialize my model into an XML file. Since Graph Link Model has IList as member so, I am getting this exception that “interface cannot be serialized.”

Have you tried implementing IXmlSerializable?

Also I have to ask why you are not just using model.Save?

Hi Walter, it works fine now.
I did it using IXmlSerializable but I was not getting anything on the XML file.
I didn’t do it using model.Save because I was getting an error that it has some invalid arguments.
I tried this:
Model.Save<DistributionNetworkNode,UniversalLinkData>(“key”, nodes, links);

OK, I’m glad you figured it out.

Would you want to share what you did with other people that read this forum topic? You don’t have to if you don’t want to.

Sorry for the late reply. I implemented IXmlSerializable and serialized nodes. I got the all the properties including location and it worked perfectly for me.
Reason I didn’t use model.Save<> was that I created my own type for Nodes.