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 System.Xml.Serialization.XmlSerializer class. To use this class, use the System.Xml.Serialization.XmlSerializer.#ctor constructor to create an instance of the class using the type of the object to serialize. Once an System.Xml.Serialization.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 System.IO.Stream, System.IO.TextWriter, or System.Xml.XmlWriter. You can then call the System.Xml.Serialization.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 System.IO.Stream, System.IO.TextWriter, or System.Xml.XmlWriter). Invoke the System.Xml.Serialization.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 System.Xml.Serialization.XmlElementAttribute attribute to the member. When applying the attribute, you can specify details such as the actual XML element name using the System.Xml.Serialization.XmlElementAttribute.ElementName property. For a complete list of all the attributes, see the System.Xml.Serialization.XmlSerializer class overview.
Type | Reason |
---|---|
CodeExporter |
Represents a class that can generate proxy code from an XML representation of a data structure. |
CodeGenerationOptions |
Specifies various options to use when generating .NET Framework types for use with an XML Web Service. |
CodeIdentifier |
Provides static methods to convert input text into names for code entities. |
CodeIdentifiers |
Maintains a group of names for related code entities or type mappings that are generated by the .NET Framework's XML serialization infrastructure. |
ImportContext |
Describes the context in which a set of schema is bound to .NET Framework code entities. |
IXmlSerializable |
Provides custom formatting for XML serialization and deserialization. |
IXmlTextParser |
Establishes a System.Xml.Serialization.IXmlTextParser.Normalized property for use by the .NET Framework infrastructure. |
SchemaImporter |
Describes a schema importer. |
SoapAttributeAttribute |
Specifies that the System.Xml.Serialization.XmlSerializer must serialize the class member as an encoded SOAP attribute. |
SoapAttributeOverrides |
Allows you to override attributes applied to properties, fields, and classes when you use an System.Xml.Serialization.XmlSerializer to serialize or deserialize an object as encoded SOAP. |
SoapAttributes |
Represents a collection of attribute objects that control how the System.Xml.Serialization.XmlSerializer serializes and deserializes SOAP methods. |
SoapCodeExporter |
Generates types and attribute declarations from internal type mapping information for SOAP-encoded message parts defined in a WSDL document. |
SoapElementAttribute |
Specifies that the public member value be serialized by the System.Xml.Serialization.XmlSerializer as an encoded SOAP XML element. |
SoapEnumAttribute |
Controls how the System.Xml.Serialization.XmlSerializer serializes an enumeration member. |
SoapIgnoreAttribute |
Instructs the System.Xml.Serialization.XmlSerializer not to serialize the public field or public read/write property value. |
SoapIncludeAttribute |
Allows the System.Xml.Serialization.XmlSerializer to recognize a type when it serializes or deserializes an object as encoded SOAP XML. |
SoapReflectionImporter |
Generates mappings to SOAP-encoded messages from .NET Framework types or Web service method information. |
SoapSchemaExporter |
Populates System.Xml.Schema.XmlSchema objects with XML Schema data type definitions for .NET Framework types that are serialized using SOAP encoding. |
SoapSchemaImporter |
Used within the .NET Framework to generate internal mappings to .NET Framework types for SOAP-encoded message parts in a WSDL document. |
SoapSchemaMember |
Represents certain attributes of a XSD <part> element in a WSDL document for generating classes from the document. |
SoapTypeAttribute |
Controls the schema generated by the System.Xml.Serialization.XmlSerializer when a class instance is serialized as SOAP encoded XML. |
UnreferencedObjectEventArgs |
Provides data for the known, but unreferenced, object found in an encoded SOAP XML stream during deserialization. |
UnreferencedObjectEventHandler |
Represents the method that handles the System.Xml.Serialization.XmlSerializer.UnreferencedObject event of an System.Xml.Serialization.XmlSerializer. |
XmlAnyAttributeAttribute |
Specifies that the member (a field that returns an array of System.Xml.XmlAttribute objects) can contain any XML attributes. |
XmlAnyElementAttribute |
Specifies that the member (a field that returns an array of System.Xml.XmlElement or System.Xml.XmlNode objects) contains objects that represent any XML element that has no corresponding member in the object being serialized or deserialized. |
XmlAnyElementAttributes |
Represents a collection of System.Xml.Serialization.XmlAnyElementAttribute objects. |
XmlArrayAttribute |
Specifies that the System.Xml.Serialization.XmlSerializer must serialize a particular class member as an array of XML elements. |
XmlArrayItemAttribute |
Represents an attribute that specifies the derived types that the System.Xml.Serialization.XmlSerializer can place in a serialized array. |
XmlArrayItemAttributes |
Represents a collection of System.Xml.Serialization.XmlArrayItemAttribute objects. |
XmlAttributeAttribute |
Specifies that the System.Xml.Serialization.XmlSerializer must serialize the class member as an XML attribute. |
XmlAttributeEventArgs |
Provides data for the System.Xml.Serialization.XmlSerializer.UnknownAttribute event. |
XmlAttributeEventHandler |
Represents the method that handles the System.Xml.Serialization.XmlSerializer.UnknownAttribute |
XmlAttributeOverrides |
Allows you to override property, field, and class attributes when you use the System.Xml.Serialization.XmlSerializer to serialize or deserialize an object. |
XmlAttributes |
Represents a collection of attribute objects that control how the System.Xml.Serialization.XmlSerializer serializes and deserializes an object. |
XmlChoiceIdentifierAttribute |
Specifies that the member can be further detected by using an enumeration. |
XmlCodeExporter |
Generates types and attribute declarations from internal type mapping information for XML schema element declarations. |
XmlDeserializationEvents |
Contains fields that can be used to pass event delegates to a thread-safe erload:System.Xml.Serialization.XmlSerializer.Deserialize method of the System.Xml.Serialization.XmlSerializer. |
XmlElementAttribute |
Indicates that a public field or property represents an XML element when the System.Xml.Serialization.XmlSerializer serializes or deserializes the object that contains it. |
XmlElementAttributes |
Represents a collection of System.Xml.Serialization.XmlElementAttribute objects used by the System.Xml.Serialization.XmlSerializer to override the default way it serializes a class. |
XmlElementEventArgs |
Provides data for the System.Xml.Serialization.XmlSerializer.UnknownElement event. |
XmlElementEventHandler |
Represents the method that handles the System.Xml.Serialization.XmlSerializer.UnknownElement event of an System.Xml.Serialization.XmlSerializer. |
XmlEnumAttribute |
Controls how the System.Xml.Serialization.XmlSerializer serializes an enumeration member. |
XmlIgnoreAttribute |
Instructs the System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter, object) method of the System.Xml.Serialization.XmlSerializer not to serialize the public field or public read/write property value. |
XmlIncludeAttribute |
Allows the System.Xml.Serialization.XmlSerializer to recognize a type when it serializes or deserializes an object. |
XmlMapping |
Supports mappings between .NET Framework types and XML Schema data types. |
XmlMappingAccess |
Specifies whether a mapping is read, write, or both. |
XmlMemberMapping |
Maps a code entity in a .NET Framework Web service method to an element in a Web Services Description Language (WSDL) message. |
XmlMembersMapping |
Provides mappings between .NET Framework Web service methods and Web Services Description Language (WSDL) messages that are defined for SOAP Web services. |
XmlNamespaceDeclarationsAttribute |
Specifies that the target property, parameter, return value, or class member contains prefixes associated with namespaces that are used within an XML document. |
XmlNodeEventArgs |
Provides data for the System.Xml.Serialization.XmlSerializer.UnknownNode event. |
XmlNodeEventHandler |
Represents the method that handles the System.Xml.Serialization.XmlSerializer.UnknownNode event of an System.Xml.Serialization.XmlSerializer. |
XmlReflectionImporter |
Generates mappings to XML schema element declarations, including literal XML Schema Definition (XSD) message parts in a Web Services Description Language (WSDL) document, for .NET Framework types or Web service method information. |
XmlReflectionMember |
Provides mappings between code entities in .NET Framework Web service methods and the content of Web Services Description Language (WSDL) messages that are defined for SOAP Web services. |
XmlRootAttribute |
Controls XML serialization of the attribute target as an XML root element. |
XmlSchemaEnumerator |
Enables iteration over a collection of System.Xml.Schema.XmlSchema objects. |
XmlSchemaExporter |
Populates System.Xml.Schema.XmlSchema objects with XML schema element declarations that are found in type mapping objects. |
XmlSchemaImporter |
Generates internal mappings to .NET Framework types for XML schema element declarations, including literal XSD message parts in a WSDL document. |
XmlSchemaProviderAttribute |
When applied to a type, stores the name of a static method of the type that returns an XML schema and a System.Xml.XmlQualifiedName (or System.Xml.Schema.XmlSchemaType for anonymous types) that controls the serialization of the type. |
XmlSchemas |
Represents the collection of XML schemas. |
XmlSerializationCollectionFixupCallback |
Delegate used by the System.Xml.Serialization.XmlSerializer class for deserialization of SOAP-encoded XML data types that map to collections or enumerations. |
XmlSerializationFixupCallback |
Delegate used by the System.Xml.Serialization.XmlSerializer class for deserialization of SOAP-encoded XML data. |
XmlSerializationGeneratedCode |
An abstract class that is the base class for System.Xml.Serialization.XmlSerializationReader and System.Xml.Serialization.XmlSerializationWriter and that contains methods common to both of these types. |
XmlSerializationReadCallback |
Delegate used by the System.Xml.Serialization.XmlSerializer class for deserialization of types from SOAP-encoded, non-root XML data. |
XmlSerializationReader |
Controls deserialization by the System.Xml.Serialization.XmlSerializer class. |
XmlSerializationReader+CollectionFixup | Documentation for this section has not yet been entered. |
XmlSerializationReader+CollectionItemFixup | Documentation for this section has not yet been entered. |
XmlSerializationReader+Fixup | Documentation for this section has not yet been entered. |
XmlSerializationWriteCallback |
Delegate that is used by the System.Xml.Serialization.XmlSerializer class for serialization of types from SOAP-encoded, non-root XML data. |
XmlSerializationWriter |
Represents an abstract class used for controlling serialization by the System.Xml.Serialization.XmlSerializer class. |
XmlSerializer |
Serializes and deserializes objects into and from XML documents. The System.Xml.Serialization.XmlSerializer enables you to control how objects are encoded into XML. |
XmlSerializerAssemblyAttribute |
Applied to a Web service client proxy, enables you to specify an assembly that contains custom-made serializers. |
XmlSerializerFactory |
Creates typed versions of the System.Xml.Serialization.XmlSerializer for more efficient serialization. |
XmlSerializerImplementation |
Defines the reader, writer, and methods for pre-generated, typed serializers. |
XmlSerializerNamespaces |
Contains the XML namespaces and prefixes that the System.Xml.Serialization.XmlSerializer uses to generate qualified names in an XML-document instance. |
XmlSerializerVersionAttribute |
Signifies that the code was generated by the serialization infrastructure and can be reused for increased performance, when this attribute is applied to an assembly. |
XmlTextAttribute |
Indicates to the System.Xml.Serialization.XmlSerializer that the member must be treated as XML text when the class that contains it is serialized or deserialized. |
XmlTypeAttribute |
Controls the XML schema that is generated when the attribute target is serialized by the System.Xml.Serialization.XmlSerializer. |
XmlTypeMapping |
Contains a mapping of one type to another. |