The System.Xml.Serialization namespace contains classes that are used to serialize objects into XML format documents or streams.
The central class in the namespace is the XmlSerializer class. To use this class, use the XmlSerializer.#ctor constructor to create an instance of the class using the type of the object to serialize. Once an XmlSerializer is created, create an instance of the object to serialize. You must also create an object to write the file to a document or stream, such as a Stream, TextWriter, or XmlWriter. You can then call the XmlSerializer.Serialize method to convert the object into an XML document.
To deserialize an object from an XML document, create a suitable object to read the document or stream (again, a Stream, TextWriter, or XmlWriter). Invoke the XmlSerializer.Deserialize method while casting the resulting object to the type of the original object (that was serialized).
To further control the serialization, the System.Xml.Serialization namespace contains several Attribute classes that can be applied to members of a class. For example, if a class contains a member that will be serialized as an XML element, you can apply the XmlElementAttribute attribute to the member. When applying the attribute, you can specify details such as the actual XML element name using the XmlElementAttribute.ElementName property. For a complete list of all the attributes, see the XmlSerializer class overview.
Class | Description |
---|---|
class CodeIdentifier |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
class CodeIdentifiers |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
class XmlSerializationReader.CollectionFixup | Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlSerializationReader.Fixup |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class SoapAttributeAttribute | Specifies that the XmlSerializer should serialize the class member as an encoded SOAP attribute. |
class SoapAttributeOverrides | Allows you to override property, field, and class attributes when you use an XmlSerializer to serialize or deserialize an object as encoded SOAP. |
class SoapAttributes | Represents a collection of attribute objects that control how the XmlSerializer serializes and deserializes SOAP methods. |
class SoapCodeExporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
class SoapElementAttribute | Specifies that the public member value be serialized by the XmlSerializer as an encoded SOAP XML element. |
class SoapEnumAttribute | Controls how the XmlSerializer serializes an enumeration member. |
class SoapIgnoreAttribute | Instructs the XmlSerializer not to serialize the public field or public read/write property value. |
class SoapIncludeAttribute | Allows the XmlSerializer to recognize a type when it serializes or deserializes an object as encoded SOAP XML. |
class SoapReflectionImporter | Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class SoapSchemaExporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class SoapSchemaImporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class SoapSchemaMember |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class SoapTypeAttribute | Controls the schema generated by the XmlSerializer when a class instance is serialized as SOAP encoded XML. |
class UnreferencedObjectEventArgs | Provides data for the known, but unreferenced, object found in an encoded SOAP XML stream during deserialization. |
class XmlAnyAttributeAttribute | Specifies that the member (a field that returns an array of XmlAttribute objects) can contain any XML attributes. |
class XmlAnyElementAttribute | Specifies that the member (a field that returns an array of XmlElement or XmlNode objects) can contain objects that represent any XML element that has no corresponding member in the object being serialized or deserialized. |
class XmlAnyElementAttributes | Represents a collection of XmlAnyElementAttribute objects. |
class XmlArrayAttribute | Specifies that the XmlSerializer should serialize a particular class member as an array of XML elements. |
class XmlArrayItemAttribute | Specifies the derived types that the XmlSerializer can place in a serialized array. |
class XmlArrayItemAttributes | Represents a collection of XmlArrayItemAttribute objects. |
class XmlAttributeAttribute | Specifies that the XmlSerializer should serialize the class member as an XML attribute. |
class XmlAttributeEventArgs | Provides data for the XmlSerializer.UnknownAttribute event. |
class XmlAttributeOverrides | Allows you to override property, field, and class attributes when you use the XmlSerializer to serialize or deserialize an object. |
class XmlAttributes | Represents a collection of attribute objects that control how the XmlSerializer serializes and deserializes an object. |
class XmlChoiceIdentifierAttribute | Specifies that the member can be further disambiguated by using an enumeration. |
class XmlCodeExporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
class XmlElementAttribute | Indicates that a public field or property represents an XML element when the XmlSerializer serializes or deserializes the containing object. |
class XmlElementAttributes | Represents a collection of XmlElementAttribute, which the XmlSerializer uses to override the default way it serializes a class. |
class XmlElementEventArgs | Provides data for the XmlSerializer.UnknownElement event. |
class XmlEnumAttribute | Controls how the XmlSerializer serializes an enumeration member. |
class XmlIgnoreAttribute | Instructs the XmlSerializer.Serialize method of the XmlSerializer not to serialize the public field or public read/write property value. |
class XmlIncludeAttribute | Allows the XmlSerializer to recognize a type when it serializes or deserializes an object. |
class XmlMapping |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlMemberMapping |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
class XmlMembersMapping |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlNamespaceDeclarationsAttribute | Specifies that the target property, parameter, return value or class member contains prefixes associated with namespaces that are used within an XML document. |
class XmlNodeEventArgs | Provides data for the XmlSerializer.UnknownNode event. |
class XmlReflectionImporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlReflectionMember |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlRootAttribute | Identifies a class, structure, enumeration, or interface as the root (or top-level) element of an XML-document instance. |
class XmlSchemaExporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlSchemaImporter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlSchemas |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Represents the collection of XML schemas. |
class XmlSerializationReader |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlSerializationWriter |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
class XmlSerializer | Serializes and deserializes objects into and from XML documents. The XmlSerializer enables you to control how objects are encoded into XML. |
class XmlSerializerNamespaces | Contains the XML namespaces and prefixes that the XmlSerializer uses to generate qualified names in an XML-document instance. |
class XmlTextAttribute | Indicates to the XmlSerializer that the member should be treated as XML text when the containing class is serialized or deserialized. |
class XmlTypeAttribute | Controls the XML schema generated when the attribute target is serialized by the XmlSerializer. |
class XmlTypeMapping | Contains a mapping of one type to another. |
Interface | Description |
---|---|
interface IXmlSerializable |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Provides a custom serialization format for a serializable object. |
Delegate | Description |
---|---|
delegate UnreferencedObjectEventHandler | Represents the method that will handle the XmlSerializer.UnreferencedObject event of an XmlSerializer. |
delegate XmlAttributeEventHandler | Represents the method that will handle the XmlSerializer.UnknownAttribute |
delegate XmlElementEventHandler | Represents the method that will handle the XmlSerializer.UnknownElement event of an XmlSerializer. |
delegate XmlNodeEventHandler | Represents the method that will handle the XmlSerializer.UnknownNode event of an XmlSerializer. |
delegate XmlSerializationCollectionFixupCallback |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
delegate XmlSerializationFixupCallback |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
delegate XmlSerializationReadCallback |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
delegate XmlSerializationWriteCallback |
This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |