次の方法で共有


DataContractSerializer Constructor

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Include Protected Members
Include Inherited Members

Include Silverlight Members
Include Silverlight for Windows Phone Members
Include XNA Framework Members

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.

Overload List

  Name Description
Public methodSupported by Silverlight for Windows Phone DataContractSerializer(Type) Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type.
Public methodSupported by Silverlight for Windows Phone 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 methodSupported by Silverlight for Windows Phone 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 methodSupported by Silverlight for Windows Phone 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 methodSupported by Silverlight for Windows Phone 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 methodSupported by Silverlight for Windows Phone 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

Exceptions

Exception Condition
InvalidDataContractException

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