XmlSerializer.GenerateSerializer Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public:
static System::Reflection::Assembly ^ GenerateSerializer(cli::array <Type ^> ^ types, cli::array <System::Xml::Serialization::XmlMapping ^> ^ mappings);
public static System.Reflection.Assembly GenerateSerializer (Type[] types, System.Xml.Serialization.XmlMapping[] mappings);
static member GenerateSerializer : Type[] * System.Xml.Serialization.XmlMapping[] -> System.Reflection.Assembly
Public Shared Function GenerateSerializer (types As Type(), mappings As XmlMapping()) As Assembly
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
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.
public:
static System::Reflection::Assembly ^ GenerateSerializer(cli::array <Type ^> ^ types, cli::array <System::Xml::Serialization::XmlMapping ^> ^ mappings, System::CodeDom::Compiler::CompilerParameters ^ parameters);
public static System.Reflection.Assembly GenerateSerializer (Type[] types, System.Xml.Serialization.XmlMapping[] mappings, System.CodeDom.Compiler.CompilerParameters parameters);
static member GenerateSerializer : Type[] * System.Xml.Serialization.XmlMapping[] * System.CodeDom.Compiler.CompilerParameters -> System.Reflection.Assembly
Public Shared Function GenerateSerializer (types As Type(), mappings As XmlMapping(), parameters As CompilerParameters) As Assembly
Parameters
- 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.