DataContractSerializer Constructor (Type)


Initializes a new instance of the DataContractSerializer class to serialize or deserialize an object of the specified type.

Namespace:   System.Runtime.Serialization
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

public DataContractSerializer(
	Type type


Type: System.Type

The type of the instances that are serialized or deserialized.

The following example creates an instance of the DataContractSerializer that specifies the type to serialize or deserialize.

public static void Constructor1()
    // Create an instance of the DataContractSerializer.
    DataContractSerializer ser =
        new DataContractSerializer(typeof(Person));
    // Other code not shown.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top