[ Team LiB ] |
This type provides the core functionality of the System.Xml.Serialization namespace. Various constructors are used to create an instance based on a System.Type or a XmlTypeMapping, and some include parameters to provide extra information on how the object is to be serialized. The staticFromTypes( ) method will create an array of XmlSerializer instances suitable for serializing and deserializing an array of System.Type instances passed in. The Serialize( ) method does the work of encoding to XML an instance of an object of the type the XmlSerializer is made for. The serialization is performed according to the attributes placed on the object and its members, as well as any XmlAttributeOverrides passed into the constructor. An object can be serialized to any System.IO.Stream, System.IO.TextWriter, or System.Xml.XmlWriter instance. The staticDeserialize( ) method decodes an object from XML into an instance of the object in memory. The XML object can be deserialized from any System.IO.Stream, System.IO.TextReader, or System.Xml.XmlReader instance that contains XML. Additionally, if using a System.Xml.XmlReader, the CanDeserialize( ) method indicates whether the data in the XML stream is of the proper type to be deserialized by this instance of XmlSerializer. During deserialization, the XmlSerializer may fire one or more of four events. The UnreferencedObject event is fired if an object deserialized from a SOAP stream has no other object referencing it. If an unknown node is encountered in the XML stream, the UnknownNode event is fired, followed by the UnknownAttribute event if the node is a System.Xml.XmlAttribute, or the UnknownElement event if the node is a System.Xml.XmlElement. An XmlSerializer instance is created specifically to provide XML serialization for one particular type of object. At the time the XmlSerializer is instantiated, the .NET Framework generates a private assembly to perform the serialization. Because of this, the first time you create a serializer for a particular type, there may be some performance degradation. |
[ Team LiB ] |