DataContractSerializerOperationBehavior.CreateSerializer Method

Definition

Creates an instance of a class that inherits from XmlObjectSerializer for serialization and deserialization processes.

Overloads

CreateSerializer(Type, String, String, IList<Type>)

Creates an instance of a class that inherits from XmlObjectSerializer for serialization and deserialization processes.

CreateSerializer(Type, XmlDictionaryString, XmlDictionaryString, IList<Type>)

Creates an instance of a class that inherits from XmlObjectSerializer for serialization and deserialization processes with an XmlDictionaryString that contains the namespace.

CreateSerializer(Type, String, String, IList<Type>)

Source:
DataContractSerializerOperationBehavior.cs
Source:
DataContractSerializerOperationBehavior.cs

Creates an instance of a class that inherits from XmlObjectSerializer for serialization and deserialization processes.

C#
public virtual System.Runtime.Serialization.XmlObjectSerializer CreateSerializer(Type type, string name, string ns, System.Collections.Generic.IList<Type> knownTypes);

Parameters

type
Type

The Type to create the serializer for.

name
String

The name of the generated type.

ns
String

The namespace of the generated type.

knownTypes
IList<Type>

An IList<T> of Type that contains known types.

Returns

An instance of a class that inherits from the XmlObjectSerializer class.

Remarks

Both the NetDataContractSerializer and the DataContractSerializer inherit from the XmlObjectSerializer class.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

CreateSerializer(Type, XmlDictionaryString, XmlDictionaryString, IList<Type>)

Source:
DataContractSerializerOperationBehavior.cs
Source:
DataContractSerializerOperationBehavior.cs

Creates an instance of a class that inherits from XmlObjectSerializer for serialization and deserialization processes with an XmlDictionaryString that contains the namespace.

C#
public virtual System.Runtime.Serialization.XmlObjectSerializer CreateSerializer(Type type, System.Xml.XmlDictionaryString name, System.Xml.XmlDictionaryString ns, System.Collections.Generic.IList<Type> knownTypes);

Parameters

type
Type

The type to serialize or deserialize.

name
XmlDictionaryString

The name of the serialized type.

ns
XmlDictionaryString

An XmlDictionaryString that contains the namespace of the serialized type.

knownTypes
IList<Type>

An IList<T> of Type that contains known types.

Returns

An instance of a class that inherits from the XmlObjectSerializer class.

Remarks

Both the DataContractSerializer and the NetDataContractSerializer inherit from the XmlObjectSerializer class.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0