DataContractSerializer Constructor

DataContractSerializer Constructor

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Initializes a new instance of the DataContractSerializer class.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method DataContractSerializer(Type) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type.
Public method DataContractSerializer(Type, IEnumerable<Type>) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type, and a collection of known types that may be present in the object graph.
Public method DataContractSerializer(Type, DataContractSerializerSettings) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type and settings.
Public method DataContractSerializer(Type, String, String) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type using the supplied XML root element and namespace.
Public method DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type using the XML root element and namespace specified through the parameters of type XmlDictionaryString.
Public method DataContractSerializer(Type, String, String, IEnumerable<Type>) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type. This method also specifies the root XML element and namespace in two string parameters as well as a list of known types that may be present in the object graph.
Public method DataContractSerializer(Type, XmlDictionaryString, XmlDictionaryString, IEnumerable<Type>) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type. This method also specifies the root XML element and namespace in two XmlDictionaryString parameters as well as a list of known types that may be present in the object graph.
Top

ExceptionCondition
InvalidDataContractException

The type being serialized does not conform to data contract rules. For example, the DataContractAttribute attribute has not been applied to the type.

Show:
© 2017 Microsoft