The namespace contains classes that are used to serialize objects into XML format documents or streams.

The central class in the namespace is the class. To use this class, use the constructor to create an instance of the class using the type of the object to serialize. Once an 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 , , or . You can then call the 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 , , or ). Invoke the method while casting the resulting object to the type of the original object (that was serialized).

To further control the serialization, the namespace contains several 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 attribute to the member. When applying the attribute, you can specify details such as the actual XML element name using the property. For a complete list of all the attributes, see the class overview.