Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NetDataContractSerializer Constructor (String^, String^, StreamingContext, Int32, Boolean, FormatterAssemblyStyle, ISurrogateSelector^)

 

Initializes a new instance of the NetDataContractSerializer class with the supplied context data and root name and namespace; in addition, specifies the maximum number of items in the object to be serialized, and parameters to specify whether extra data is ignored, the assembly loading method, and a surrogate selector.

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

public:
NetDataContractSerializer(
	String^ rootName,
	String^ rootNamespace,
	StreamingContext context,
	int maxItemsInObjectGraph,
	bool ignoreExtensionDataObject,
	FormatterAssemblyStyle assemblyFormat,
	ISurrogateSelector^ surrogateSelector
)

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.

context
Type: System.Runtime.Serialization::StreamingContext

A StreamingContext that contains context data.

maxItemsInObjectGraph
Type: System::Int32

The maximum number of items in the graph to serialize or deserialize.

ignoreExtensionDataObject
Type: System::Boolean

true to ignore the data supplied by an extension of the type; otherwise, false.

assemblyFormat
Type: System.Runtime.Serialization.Formatters::FormatterAssemblyStyle

A FormatterAssemblyStyle enumeration value that specifies a method for locating and loading assemblies.

surrogateSelector
Type: System.Runtime.Serialization::ISurrogateSelector^

An implementation of the IDataContractSurrogate to handle the legacy type.

Exception Condition
ArgumentOutOfRangeException

maxItemsInObjectGraph value is less than 0.

The ignoreExtensionDataObject parameter is used when the IExtensibleDataObject interface is implemented in the class that is being serialized or deserialized.

The following example creates an instance of the NetDataContractSerializer specifying the XML element name and namespace to expect when deserializing. The code also sets the ignoreExtensionDataObject, and specifies an implementation of the ISurrogateSelector interface to handle to assist the serializer when selecting a surrogate (for deserializing legacy types).

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft