This documentation is archived and is not being maintained.

NetDataContractSerializer.WriteObjectContent Method (XmlWriter, Object)

Writes the XML content using an XmlWriter.

Namespace: System.Runtime.Serialization
Assembly: System.Runtime.Serialization (in system.runtime.serialization.dll)

public override void WriteObjectContent (
	XmlWriter writer,
	Object graph
public void WriteObjectContent (
	XmlWriter writer, 
	Object graph
public override function WriteObjectContent (
	writer : XmlWriter, 
	graph : Object
Not applicable.



The XmlWriter used to write the XML content.


The object to serialize. All child objects of this root object are automatically serialized.

Exception typeCondition


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 serialized.


the maximum number of object to serialize has been exceeded. Check the MaxItemsInObjectGraph property.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0