XmlSerializer.GenerateSerializer XmlSerializer.GenerateSerializer XmlSerializer.GenerateSerializer XmlSerializer.GenerateSerializer Method

定義

傳回包含具型別序列化程式的組件。Returns an assembly that contains typed serializers.

多載

GenerateSerializer(Type[], XmlMapping[]) GenerateSerializer(Type[], XmlMapping[]) GenerateSerializer(Type[], XmlMapping[]) 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) GenerateSerializer(Type[], XmlMapping[], CompilerParameters) GenerateSerializer(Type[], XmlMapping[], CompilerParameters) 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.

備註

XML 序列化程式產生器工具(Sgen)會針對指定元件中的類型建立 XML 序列化元件,以便在序列化或還原序列化指定類型的物件XmlSerializer時,改善的執行時間效能。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. GetXmlSerializerAssemblyName使用傳回這類元件的名稱。Use the GetXmlSerializerAssemblyName to return the name of such an assembly.

如果您要將這類元件散發為呼叫 Web 服務之用戶端應用程式的一部分,您可以將XmlSerializerAssemblyAttribute套用至用戶端類型,以指定元件的位置和名稱。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[]) GenerateSerializer(Type[], XmlMapping[]) GenerateSerializer(Type[], XmlMapping[]) 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

參數

types
Type[]

型別集合。A collection of types.

mappings
XmlMapping[]

XmlMapping 物件集合,用於將一個型別轉換為另一個型別。A collection of XmlMapping objects used to convert one type to another.

傳回

Assembly 物件,包含所提供型別和對應的序列化程式。An Assembly object that contains serializers for the supplied types and mappings.

GenerateSerializer(Type[], XmlMapping[], CompilerParameters) GenerateSerializer(Type[], XmlMapping[], CompilerParameters) GenerateSerializer(Type[], XmlMapping[], CompilerParameters) 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

參數

types
Type[]

型別 Type 的陣列,包含用於序列化和還原序列化資料的物件。An array of type Type that contains objects used to serialize and deserialize data.

mappings
XmlMapping[]

型別 XmlMapping 的陣列,將 XML 資料對應至型別資料。An array of type XmlMapping that maps the XML data to the type data.

parameters
CompilerParameters CompilerParameters CompilerParameters CompilerParameters

CompilerParameters 類別的執行個體,表示用於叫用編譯器的參數。An instance of the CompilerParameters class that represents the parameters used to invoke a compiler.

傳回

Assembly,包含 XmlSerializer 的特殊版本。An Assembly that contains special versions of the XmlSerializer.

適用於