Επεξεργασία

Κοινή χρήση μέσω


XmlSerializerFactory.CreateSerializer Method

Definition

Returns a derivation of the XmlSerializer class that is used to serialize a type.

Overloads

CreateSerializer(Type)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that is used to serialize the specified type.

CreateSerializer(XmlTypeMapping)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class using an object that maps one type to another.

CreateSerializer(Type, String)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that is used to serialize the specified type and namespace.

CreateSerializer(Type, Type[])

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that is used to serialize the specified type. If a property or field returns an array, the extraTypes parameter specifies objects that can be inserted into the array.

CreateSerializer(Type, XmlAttributeOverrides)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML documents, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes.

CreateSerializer(Type, XmlRootAttribute)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML documents, and vice versa. Specifies the object that represents the XML root element.

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String, String)

This API supports the product infrastructure and is not intended to be used directly from your code.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String, String, Evidence)

This API supports the product infrastructure and is not intended to be used directly from your code.

Obsolete.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

CreateSerializer(Type)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that is used to serialize the specified type.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type);
member this.CreateSerializer : Type -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type) As XmlSerializer

Parameters

type
Type

The Type to serialize.

Returns

A derivation of the XmlSerializer class that is specifically created to serialize the specified type.

Applies to

CreateSerializer(XmlTypeMapping)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class using an object that maps one type to another.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(System::Xml::Serialization::XmlTypeMapping ^ xmlTypeMapping);
public System.Xml.Serialization.XmlSerializer CreateSerializer (System.Xml.Serialization.XmlTypeMapping xmlTypeMapping);
member this.CreateSerializer : System.Xml.Serialization.XmlTypeMapping -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (xmlTypeMapping As XmlTypeMapping) As XmlSerializer

Parameters

xmlTypeMapping
XmlTypeMapping

An XmlTypeMapping that maps one type to another.

Returns

A derivation of the XmlSerializer class that is specifically created to serialize the mapped type.

Applies to

CreateSerializer(Type, String)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that is used to serialize the specified type and namespace.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::String ^ defaultNamespace);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, string? defaultNamespace);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, string defaultNamespace);
member this.CreateSerializer : Type * string -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, defaultNamespace As String) As XmlSerializer

Parameters

type
Type

The Type to serialize.

defaultNamespace
String

The default namespace to use for all the XML elements.

Returns

A derivation of the XmlSerializer class that is specifically created to serialize the specified type.

Applies to

CreateSerializer(Type, Type[])

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that is used to serialize the specified type. If a property or field returns an array, the extraTypes parameter specifies objects that can be inserted into the array.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, cli::array <Type ^> ^ extraTypes);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, Type[]? extraTypes);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, Type[] extraTypes);
member this.CreateSerializer : Type * Type[] -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, extraTypes As Type()) As XmlSerializer

Parameters

type
Type

The Type to serialize.

extraTypes
Type[]

A Type array of additional object types to serialize.

Returns

A derivation of the XmlSerializer.

Remarks

Calling this overload is similar to calling the XmlSerializer(Type, Type[]) to create an instance of the XmlSerializer class.

Applies to

CreateSerializer(Type, XmlAttributeOverrides)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML documents, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides);
member this.CreateSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, overrides As XmlAttributeOverrides) As XmlSerializer

Parameters

type
Type

The Type to serialize.

overrides
XmlAttributeOverrides

An XmlAttributeOverrides that contains fields that override the default serialization behavior.

Returns

A derivation of the XmlSerializer.

Remarks

Calling this overload is similar to calling the XmlSerializer(Type, XmlAttributeOverrides) to create an instance of the XmlSerializer class.

Applies to

CreateSerializer(Type, XmlRootAttribute)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML documents, and vice versa. Specifies the object that represents the XML root element.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::Xml::Serialization::XmlRootAttribute ^ root);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlRootAttribute? root);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlRootAttribute root);
member this.CreateSerializer : Type * System.Xml.Serialization.XmlRootAttribute -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, root As XmlRootAttribute) As XmlSerializer

Parameters

type
Type

The Type to serialize.

root
XmlRootAttribute

An XmlRootAttribute that represents the XML root element.

Returns

A derivation of the XmlSerializer.

Remarks

Calling this overload is similar to calling the XmlSerializer.XmlSerializer(Type, XmlRootAttribute) to create an instance of the XmlSerializer class.

Applies to

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides, Type[]? extraTypes, System.Xml.Serialization.XmlRootAttribute? root, string? defaultNamespace);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace);
member this.CreateSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String) As XmlSerializer

Parameters

type
Type

The Type to serialize.

overrides
XmlAttributeOverrides

An XmlAttributeOverrides that contains fields that override the default serialization behavior.

extraTypes
Type[]

A Type array of additional object types to serialize.

root
XmlRootAttribute

An XmlRootAttribute that represents the XML root element.

defaultNamespace
String

The default namespace of all XML elements in the XML document.

Returns

A derivation of the XmlSerializer.

Remarks

Calling this overload is similar to calling the XmlSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String) to create an instance of the XmlSerializer class.

Applies to

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String, String)

Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs
Source:
XmlSerializerFactory.cs

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace, System::String ^ location);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides? overrides, Type[]? extraTypes, System.Xml.Serialization.XmlRootAttribute? root, string? defaultNamespace, string? location);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location);
member this.CreateSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string * string -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String, location As String) As XmlSerializer

Parameters

type
Type

The Type of the object that this XmlSerializer can serialize.

overrides
XmlAttributeOverrides

An XmlAttributeOverrides that extends or overrides the behavior of the class specified in the type parameter.

extraTypes
Type[]

A Type array of additional object types to serialize.

root
XmlRootAttribute

An XmlRootAttribute that defines the XML root element properties.

defaultNamespace
String

The default namespace of all XML elements in the XML document.

location
String

The path that specifies the location of the types.

Returns

A derivation of the XmlSerializer.

Applies to

CreateSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String, String, Evidence)

Caution

This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateSerializer which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.

Returns a derivation of the XmlSerializer class that can serialize objects of the specified type into XML document instances, and vice versa. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes. This overload also specifies the default namespace for all the XML elements, and the class to use as the XML root element.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 System::Xml::Serialization::XmlSerializer ^ CreateSerializer(Type ^ type, System::Xml::Serialization::XmlAttributeOverrides ^ overrides, cli::array <Type ^> ^ extraTypes, System::Xml::Serialization::XmlRootAttribute ^ root, System::String ^ defaultNamespace, System::String ^ location, System::Security::Policy::Evidence ^ evidence);
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location, System.Security.Policy.Evidence evidence);
[System.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateSerializer which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]
public System.Xml.Serialization.XmlSerializer CreateSerializer (Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, string defaultNamespace, string location, System.Security.Policy.Evidence evidence);
member this.CreateSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string * string * System.Security.Policy.Evidence -> System.Xml.Serialization.XmlSerializer
[<System.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateSerializer which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")>]
member this.CreateSerializer : Type * System.Xml.Serialization.XmlAttributeOverrides * Type[] * System.Xml.Serialization.XmlRootAttribute * string * string * System.Security.Policy.Evidence -> System.Xml.Serialization.XmlSerializer
Public Function CreateSerializer (type As Type, overrides As XmlAttributeOverrides, extraTypes As Type(), root As XmlRootAttribute, defaultNamespace As String, location As String, evidence As Evidence) As XmlSerializer

Parameters

type
Type

The Type of the object that this XmlSerializer can serialize.

overrides
XmlAttributeOverrides

An XmlAttributeOverrides that extends or overrides the behavior of the class specified in the type parameter.

extraTypes
Type[]

A Type array of additional object types to serialize.

root
XmlRootAttribute

An XmlRootAttribute that defines the XML root element properties.

defaultNamespace
String

The default namespace of all XML elements in the XML document.

location
String

The path that specifies the location of the types.

evidence
Evidence

An instance of the Evidence class that contains credentials needed to access types.

Returns

A derivation of the XmlSerializer.

Attributes

Remarks

Calling this overload is similar to calling the XmlSerializer(Type, XmlAttributeOverrides, Type[], XmlRootAttribute, String, String, Evidence) to create an instance of the XmlSerializer class.

Applies to