Serialization issue
I'm trying to define an interface that allows the implementing class to define its own serialization. The serialization could be XML, delimited or fixed width. Each instance will be serialized along with other instances i.e. in the case of the XML serialization this will be an element inside of the document element.
I've looked into using ISerializable but that won't 开发者_开发技巧let me serialize within the object itself. It's possible I may have to define a serializer interface rather than define the behaviour within the class itself.
The interface represents product information by the way.
I think you don't need to implement ISerializable interface to solve this issue, maybe you just need to decorate your class with the Atributtes from System.Xml.Serialization namespace and use XmlSerializer class to serialize it.
This link maybe will help you: How to serialize an object to XML by using Visual C#
精彩评论