Olvasás angol nyelven Szerkesztés

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


XmlObjectSerializer.WriteStartObject Method

Definition

Writes only the starting XML element to an XML document or stream.

Overloads

WriteStartObject(XmlDictionaryWriter, Object)

Writes the start of the object's data as an opening XML element using the specified XmlDictionaryWriter.

WriteStartObject(XmlWriter, Object)

Writes the start of the object's data as an opening XML element using the specified XmlWriter.

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

WriteStartObject(XmlDictionaryWriter, Object)

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

Writes the start of the object's data as an opening XML element using the specified XmlDictionaryWriter.

public:
 abstract void WriteStartObject(System::Xml::XmlDictionaryWriter ^ writer, System::Object ^ graph);
public abstract void WriteStartObject (System.Xml.XmlDictionaryWriter writer, object graph);
public abstract void WriteStartObject (System.Xml.XmlDictionaryWriter writer, object? graph);
abstract member WriteStartObject : System.Xml.XmlDictionaryWriter * obj -> unit
Public MustOverride Sub WriteStartObject (writer As XmlDictionaryWriter, graph As Object)

Parameters

writer
XmlDictionaryWriter

An XmlDictionaryWriter used to write the XML document.

graph
Object

The object to serialize.

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

WriteStartObject(XmlWriter, Object)

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

Writes the start of the object's data as an opening XML element using the specified XmlWriter.

public:
 virtual void WriteStartObject(System::Xml::XmlWriter ^ writer, System::Object ^ graph);
public virtual void WriteStartObject (System.Xml.XmlWriter writer, object graph);
public virtual void WriteStartObject (System.Xml.XmlWriter writer, object? graph);
abstract member WriteStartObject : System.Xml.XmlWriter * obj -> unit
override this.WriteStartObject : System.Xml.XmlWriter * obj -> unit
Public Overridable Sub WriteStartObject (writer As XmlWriter, graph As Object)

Parameters

writer
XmlWriter

An XmlWriter used to write the XML document.

graph
Object

The object to serialize.

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