I want a method to return an XML Serialized Typed object. Is there an interface I can use to enforce this requirement?
+1
A:
IXmlSerializable will allow you to customize XML serialization/deserialization. However, it still uses XmlSerializer to serialize data to or from XML.
HackedByChinese
2009-10-27 15:23:28
A:
is this what you mean?
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.iserializable.aspx
Oren Mazor
2009-10-27 15:24:11
Nope but similar. That's the XML serialization interface, I'm referring to the XML serialization attribute. http://msdn.microsoft.com/en-us/library/2baksw0z%28VS.80%29.aspx
burnt1ce
2009-10-28 18:00:14
A:
There is no interface that means "this object can be XML Serialized". IXmlSerializable
means that the caller is stating that it implements XML Serialization on its own, and that the XML Serializer does not need to generate code to serialize it.
The following type is XML Serializable, but does not implement IXmlSerializable
:
public class SerializeMe
{
public string SomeProperty {get; set;}
}
There is no interface that could be used as a return type which could both return an IXmlSerializable
instance and the above class.
John Saunders
2009-10-28 01:49:48