IFormatter.Serialize(Stream, Object) Método

Definición

Precaución

BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.

Serializa en la secuencia proporcionada un objeto o un gráfico de objetos con la secuencia dada.Serializes an object, or graph of objects with the given root to the provided stream.

public:
 void Serialize(System::IO::Stream ^ serializationStream, System::Object ^ graph);
[System.Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId="SYSLIB0011", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Serialize (System.IO.Stream serializationStream, object graph);
public void Serialize (System.IO.Stream serializationStream, object graph);
[<System.Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId="SYSLIB0011", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Serialize : System.IO.Stream * obj -> unit
abstract member Serialize : System.IO.Stream * obj -> unit
Public Sub Serialize (serializationStream As Stream, graph As Object)

Parámetros

serializationStream
Stream

Secuencia en la que el formateador coloca los datos serializados.The stream where the formatter puts the serialized data. Esta secuencia puede hacer referencia a varias memorias auxiliares (como archivos, red, memoria, etc.).This stream can reference a variety of backing stores (such as files, network, memory, and so on).

graph
Object

Objeto, o raíz del gráfico de objetos, que se va a serializar.The object, or root of the object graph, to serialize. Todos los objetos secundarios de este objeto raíz se serializan automáticamente.All child objects of this root object are automatically serialized.

Atributos

Comentarios

El Serialize método serializa automáticamente los objetos proporcionados y todos los objetos conectados a él en el flujo proporcionado.The Serialize method automatically serializes the provided objects, and all objects connected to it, to the provided stream.

De forma predeterminada, el proceso de serialización registra el estado de un objeto mediante la recopilación de los valores de todos sus campos (público y privado).By default, the serialization process records an object's state by gathering the values of all its fields (public and private). Estos campos se guardan en la secuencia junto con información sobre el objeto, como el nombre calificado por el ensamblado para su tipo.These fields are saved to the stream along with information about the object such as the name qualified by the assembly for its type.

Se aplica a