Szerkesztés

Megosztás a következőn keresztül:


DataContractSerializer.WriteObject Method

Definition

Writes all the object data (starting XML element, content, and closing element) to an XML document or stream.

Overloads

WriteObject(XmlWriter, Object)

Writes all the object data (starting XML element, content, and closing element) to an XML document or stream with an XmlWriter.

WriteObject(XmlDictionaryWriter, Object, DataContractResolver)

Writes all the object data (starting XML element, content, and enclosing element) to an XML document or stream using the specified XmlDictionaryWriter. The method includes a resolver for mapping xsi:type declarations at runtime.

WriteObject(XmlWriter, Object)

Source:
DataContractSerializer.cs
Source:
DataContractSerializer.cs
Source:
DataContractSerializer.cs

Writes all the object data (starting XML element, content, and closing element) to an XML document or stream with an XmlWriter.

public:
 override void WriteObject(System::Xml::XmlWriter ^ writer, System::Object ^ graph);
public override void WriteObject (System.Xml.XmlWriter writer, object graph);
public override void WriteObject (System.Xml.XmlWriter writer, object? graph);
override this.WriteObject : System.Xml.XmlWriter * obj -> unit
Public Overrides Sub WriteObject (writer As XmlWriter, graph As Object)

Parameters

writer
XmlWriter

The XmlWriter used to write the XML document or stream.

graph
Object

The object that contains the data to write to the stream.

Exceptions

The type being serialized does not conform to data contract rules. For example, the DataContractAttribute attribute has not been applied to the type.

There is a problem with the instance being written.

Applies to

WriteObject(XmlDictionaryWriter, Object, DataContractResolver)

Source:
DataContractSerializer.cs
Source:
DataContractSerializer.cs
Source:
DataContractSerializer.cs

Writes all the object data (starting XML element, content, and enclosing element) to an XML document or stream using the specified XmlDictionaryWriter. The method includes a resolver for mapping xsi:type declarations at runtime.

public:
 void WriteObject(System::Xml::XmlDictionaryWriter ^ writer, System::Object ^ graph, System::Runtime::Serialization::DataContractResolver ^ dataContractResolver);
public void WriteObject (System.Xml.XmlDictionaryWriter writer, object? graph, System.Runtime.Serialization.DataContractResolver? dataContractResolver);
public void WriteObject (System.Xml.XmlDictionaryWriter writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver);
override this.WriteObject : System.Xml.XmlDictionaryWriter * obj * System.Runtime.Serialization.DataContractResolver -> unit
Public Sub WriteObject (writer As XmlDictionaryWriter, graph As Object, dataContractResolver As DataContractResolver)

Parameters

writer
XmlDictionaryWriter

An XmlDictionaryWriter used to write the content to the XML document or stream.

graph
Object

The object that contains the content to write.

dataContractResolver
DataContractResolver

An implementation of the DataContractResolver used to map xsi:type declarations to known data contracts.

Applies to