Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes only the content of an object to an XML document or stream.
WriteObjectContent(XmlDictionaryWriter, Object) |
Writes only the content of the object to the XML document or stream using the specified XmlDictionaryWriter. |
WriteObjectContent(XmlWriter, Object) |
Writes only the content of the object to the XML document or stream with the specified XmlWriter. |
The WriteStartObject, WriteObjectContent, and WriteEndObject methods must be implemented. The three methods are used in succession to write the complete serialization using the pattern: write start, write content, and write end. If the implementation writes using XML elements, attributes can be inserted before writing the contents of the object. The three methods are also called by the virtual implementation of the WriteObject method.
Writes only the content of the object to the XML document or stream using the specified XmlDictionaryWriter.
public:
abstract void WriteObjectContent(System::Xml::XmlDictionaryWriter ^ writer, System::Object ^ graph);
public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object? graph);
public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object? graph);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object? graph);
abstract member WriteObjectContent : System.Xml.XmlDictionaryWriter * obj -> unit
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member WriteObjectContent : System.Xml.XmlDictionaryWriter * obj -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member WriteObjectContent : System.Xml.XmlDictionaryWriter * obj -> unit
Public MustOverride Sub WriteObjectContent (writer As XmlDictionaryWriter, graph As Object)
An XmlDictionaryWriter used to write the XML document or stream.
The object that contains the content to write.
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 objects to serialize has been exceeded. Check the MaxItemsInObjectGraph property.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 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 |
UWP | 10.0 |
Writes only the content of the object to the XML document or stream with the specified XmlWriter.
public:
virtual void WriteObjectContent(System::Xml::XmlWriter ^ writer, System::Object ^ graph);
public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object graph);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object? graph);
public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object? graph);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object? graph);
abstract member WriteObjectContent : System.Xml.XmlWriter * obj -> unit
override this.WriteObjectContent : System.Xml.XmlWriter * obj -> unit
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member WriteObjectContent : System.Xml.XmlWriter * obj -> unit
override this.WriteObjectContent : System.Xml.XmlWriter * obj -> unit
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member WriteObjectContent : System.Xml.XmlWriter * obj -> unit
override this.WriteObjectContent : System.Xml.XmlWriter * obj -> unit
Public Overridable Sub WriteObjectContent (writer As XmlWriter, graph As Object)
The object that contains the content to write.
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 objects to serialize has been exceeded. Check the MaxItemsInObjectGraph property.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 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 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in