NetDataContractSerializer Constructor (String, String)

 

Initializes a new instance of the NetDataContractSerializer class with the supplied XML root element and namespace.

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

public NetDataContractSerializer(
	string rootName,
	string rootNamespace
)

Parameters

rootName
Type: System.String

The name of the XML element that encloses the content to serialize or deserialize.

rootNamespace
Type: System.String

The namespace of the XML element that encloses the content to serialize or deserialize.

The following example creates an instance of the DataContractSerializer specifying the XML root element and namespace it will expect when deserializing an object.

public static void Constructor3()
{
    // Create an instance of the NetDataContractSerializer
    // specifying the name and namespace as strings.
    NetDataContractSerializer ser =
        new NetDataContractSerializer(
        "Customer",
        "http://www.contoso.com");
    // Other code not shown.
}

.NET Framework
Available since 3.0
Return to top
Show: