แก้ไข

แชร์ผ่าน


XmlObjectSerializer.WriteEndObject Method

Definition

Writes the closing XML element to an XML stream or document.

Overloads

WriteEndObject(XmlWriter)

Writes the end of the object data as a closing XML element to the XML document or stream with an XmlWriter.

WriteEndObject(XmlDictionaryWriter)

Writes the end of the object data as a closing XML element to the XML document or stream with an XmlDictionaryWriter.

Remarks

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. Users can insert XML attributes during the writing of the object between the calls to WriteStartObject and WriteEndObject. The three methods are also called by the virtual implementation of the WriteObject method.

WriteEndObject(XmlWriter)

Source:
XmlObjectSerializer.cs
Source:
XmlObjectSerializer.cs
Source:
XmlObjectSerializer.cs

Writes the end of the object data as a closing XML element to the XML document or stream with an XmlWriter.

public:
 virtual void WriteEndObject(System::Xml::XmlWriter ^ writer);
public virtual void WriteEndObject (System.Xml.XmlWriter writer);
abstract member WriteEndObject : System.Xml.XmlWriter -> unit
override this.WriteEndObject : System.Xml.XmlWriter -> unit
Public Overridable Sub WriteEndObject (writer As XmlWriter)

Parameters

writer
XmlWriter

An XmlWriter used to write the XML document or 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 serialized.

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

Applies to

WriteEndObject(XmlDictionaryWriter)

Source:
XmlObjectSerializer.cs
Source:
XmlObjectSerializer.cs
Source:
XmlObjectSerializer.cs

Writes the end of the object data as a closing XML element to the XML document or stream with an XmlDictionaryWriter.

public:
 abstract void WriteEndObject(System::Xml::XmlDictionaryWriter ^ writer);
public abstract void WriteEndObject (System.Xml.XmlDictionaryWriter writer);
abstract member WriteEndObject : System.Xml.XmlDictionaryWriter -> unit
Public MustOverride Sub WriteEndObject (writer As XmlDictionaryWriter)

Parameters

writer
XmlDictionaryWriter

An XmlDictionaryWriter used to write the XML document or 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 serialized.

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

Applies to