DataContractSerializer.WriteObject DataContractSerializer.WriteObject 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) WriteObject(XmlWriter, Object) 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) 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) WriteObject(XmlWriter, Object) WriteObject(XmlWriter, Object)

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 Overrides Sub WriteObject (writer As XmlWriter, graph As Object)
Parameters
writer
XmlWriter XmlWriter XmlWriter

The XmlWriter used to write the XML document or stream.

graph
Object Object 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.

WriteObject(XmlDictionaryWriter, Object, DataContractResolver) 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.

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);
Parameters
writer
XmlDictionaryWriter XmlDictionaryWriter XmlDictionaryWriter

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

graph
Object Object Object

The object that contains the content to write.

dataContractResolver
DataContractResolver DataContractResolver DataContractResolver

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

Applies to