XmlObjectSerializer.WriteStartObject Método
Definição
Grava apenas o elemento XML inicial em um documento ou fluxo XML.Writes only the starting XML element to an XML document or stream.
Sobrecargas
| WriteStartObject(XmlDictionaryWriter, Object) |
Grava o início dos dados do objeto como um elemento XML de abertura usando o XmlDictionaryWriter especificado.Writes the start of the object's data as an opening XML element using the specified XmlDictionaryWriter. |
| WriteStartObject(XmlWriter, Object) |
Grava o início dos dados do objeto como um elemento XML de abertura usando o XmlWriter especificado.Writes the start of the object's data as an opening XML element using the specified XmlWriter. |
Comentários
Os WriteStartObject WriteObjectContent métodos, e WriteEndObject devem ser implementados.The WriteStartObject, WriteObjectContent, and WriteEndObject methods must be implemented. Os três métodos são usados sucessivamente para gravar a serialização completa usando o padrão: início da gravação, gravação de conteúdo e término da gravação.The three methods are used in succession to write the complete serialization using the pattern: write start, write content, and write end. Se a implementação for gravada usando elementos XML, os atributos poderão ser inseridos antes de gravar o conteúdo do objeto.If the implementation writes using XML elements, attributes can be inserted before writing the contents of the object. Os três métodos também são chamados pela implementação virtual do WriteObject método.The three methods are also called by the virtual implementation of the WriteObject method.
WriteStartObject(XmlDictionaryWriter, Object)
Grava o início dos dados do objeto como um elemento XML de abertura usando o XmlDictionaryWriter especificado.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)
Parâmetros
- writer
- XmlDictionaryWriter
Um XmlDictionaryWriter usado para gravar o documento XML.An XmlDictionaryWriter used to write the XML document.
- graph
- Object
O objeto a ser serializado.The object to serialize.
Exceções
O tipo que está sendo serializado não está em conformidade com as regras do contrato de dados.the type being serialized does not conform to data contract rules. Por exemplo, o atributo DataContractAttribute não foi aplicado ao tipo.For example, the DataContractAttribute attribute has not been applied to the type.
Há um problema com a instância que está sendo serializada.there is a problem with the instance being serialized.
o número máximo de objetos a serem serializados foi excedido.the maximum number of objects to serialize has been exceeded. Verifique a propriedade MaxItemsInObjectGraph.Check the MaxItemsInObjectGraph property.
Aplica-se a
WriteStartObject(XmlWriter, Object)
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)
Parâmetros
- writer
- XmlWriter
Um XmlWriter usado para gravar o documento XML.An XmlWriter used to write the XML document.
- graph
- Object
O objeto a ser serializado.The object to serialize.
Exceções
O tipo que está sendo serializado não está em conformidade com as regras do contrato de dados.the type being serialized does not conform to data contract rules. Por exemplo, o atributo DataContractAttribute não foi aplicado ao tipo.For example, the DataContractAttribute attribute has not been applied to the type.
Há um problema com a instância que está sendo serializada.there is a problem with the instance being serialized.
o número máximo de objetos a serem serializados foi excedido.the maximum number of objects to serialize has been exceeded. Verifique a propriedade MaxItemsInObjectGraph.Check the MaxItemsInObjectGraph property.