Freigeben über


XmlMediaTypeFormatter.SetSerializer Method (Type, XmlSerializer)

Registers an XmlSerializer to read or write objects of a specified type.

Namespace:  System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
Public Sub SetSerializer ( _
    type As Type, _
    serializer As XmlSerializer _
)
'Usage
Dim instance As XmlMediaTypeFormatter
Dim type As Type
Dim serializer As XmlSerializer

instance.SetSerializer(type, serializer)
public void SetSerializer(
    Type type,
    XmlSerializer serializer
)
public:
void SetSerializer(
    Type^ type, 
    XmlSerializer^ serializer
)
member SetSerializer : 
        type:Type * 
        serializer:XmlSerializer -> unit 
public function SetSerializer(
    type : Type, 
    serializer : XmlSerializer
)

Parameters

  • type
    Type: System.Type
    The type of object that will be serialized or deserialized withserializer.

Remarks

If no serializer is registered for a particular type, the XML formatter uses its default serializer. The default serializer is DataContractSerializer unless UseXmlSerializer is true.

See Also

Reference

XmlMediaTypeFormatter Class

SetSerializer Overload

System.Net.Http.Formatting Namespace