XmlSerializer.FromMappings Method

Definition

Returns an instance of the XmlSerializer class from the specified mappings.

Overloads

FromMappings(XmlMapping[], Type)

Returns an instance of the XmlSerializer class from the specified mappings.

FromMappings(XmlMapping[])

Returns an array of XmlSerializer objects created from an array of XmlTypeMapping objects.

FromMappings(XmlMapping[], Evidence)
Obsolete.

Returns an instance of the XmlSerializer class created from mappings of one XML type to another.

FromMappings(XmlMapping[], Type)

Source:
XmlSerializer.cs
Source:
XmlSerializer.cs
Source:
XmlSerializer.cs

Returns an instance of the XmlSerializer class from the specified mappings.

public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[]? mappings, Type? type);
public static System.Xml.Serialization.XmlSerializer?[] FromMappings (System.Xml.Serialization.XmlMapping[]? mappings, Type? type);
public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[] mappings, Type type);

Parameters

mappings
XmlMapping[]

An array of XmlMapping objects.

type
Type

The Type of the deserialized object.

Returns

An instance of the XmlSerializer class.

Applies to

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.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
.NET Standard 2.0, 2.1

FromMappings(XmlMapping[])

Source:
XmlSerializer.cs
Source:
XmlSerializer.cs
Source:
XmlSerializer.cs

Returns an array of XmlSerializer objects created from an array of XmlTypeMapping objects.

public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[]? mappings);
public static System.Xml.Serialization.XmlSerializer?[] FromMappings (System.Xml.Serialization.XmlMapping[]? mappings);
public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[] mappings);

Parameters

mappings
XmlMapping[]

An array of XmlTypeMapping that maps one type to another.

Returns

An array of XmlSerializer objects.

Remarks

It is recommended for callers to cache the returned serializer when there are repeated calls to this method.

Applies to

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 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
.NET Standard 2.0, 2.1

FromMappings(XmlMapping[], Evidence)

Caution

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

Returns an instance of the XmlSerializer class created from mappings of one XML type to another.

public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[] mappings, 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 FromMappings which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]
public static System.Xml.Serialization.XmlSerializer[] FromMappings (System.Xml.Serialization.XmlMapping[] mappings, System.Security.Policy.Evidence evidence);

Parameters

mappings
XmlMapping[]

An array of XmlMapping objects used to map one type to another.

evidence
Evidence

An instance of the Evidence class that contains host and assembly data presented to the common language runtime policy system.

Returns

An instance of the XmlSerializer class.

Attributes

Applies to

.NET Framework 4.8.1 et autres versions
Produit Versions (Obsolète)
.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)