Op Englesch liesen Editéieren

Deelen iwwer


XmlSerializer.GenerateSerializer Method

Definition

Returns an assembly that contains typed serializers.

Overloads

GenerateSerializer(Type[], XmlMapping[])

Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings.

GenerateSerializer(Type[], XmlMapping[], CompilerParameters)

Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings and compiler settings and options.

Remarks

The XML Serializer Generator Tool (Sgen.exe) creates an XML serialization assembly for types in a specified assembly to improve the run-time performance of an XmlSerializer when it serializes or deserializes objects of the specified types. Use the GetXmlSerializerAssemblyName to return the name of such an assembly.

If you are distributing such an assembly as part of a client application that calls a Web service, you can apply the XmlSerializerAssemblyAttribute to the client type to specify the location and name of the assembly.

GenerateSerializer(Type[], XmlMapping[])

Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings.

C#
public static System.Reflection.Assembly GenerateSerializer(Type[] types, System.Xml.Serialization.XmlMapping[] mappings);

Parameters

types
Type[]

A collection of types.

mappings
XmlMapping[]

A collection of XmlMapping objects used to convert one type to another.

Returns

An Assembly object that contains serializers for the supplied types and mappings.

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 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

GenerateSerializer(Type[], XmlMapping[], CompilerParameters)

Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings and compiler settings and options.

C#
public static System.Reflection.Assembly GenerateSerializer(Type[] types, System.Xml.Serialization.XmlMapping[] mappings, System.CodeDom.Compiler.CompilerParameters parameters);

Parameters

types
Type[]

An array of type Type that contains objects used to serialize and deserialize data.

mappings
XmlMapping[]

An array of type XmlMapping that maps the XML data to the type data.

parameters
CompilerParameters

An instance of the CompilerParameters class that represents the parameters used to invoke a compiler.

Returns

An Assembly that contains special versions of the XmlSerializer.

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 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