IFormatter.Serialize(Stream, Object) Método

Definição

Atenção

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

Serializa um objeto, ou grafo de objetos com a raiz dada ao fluxo fornecido.

public:
 void Serialize(System::IO::Stream ^ serializationStream, System::Object ^ graph);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the type of objects being processed cannot be statically discovered.")]
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}")]
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}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the Type of objects being processed cannot be statically discovered.")]
public void Serialize(System.IO.Stream serializationStream, object graph);
public void Serialize(System.IO.Stream serializationStream, object graph);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the type of objects being processed cannot be statically discovered.")>]
abstract member Serialize : System.IO.Stream * obj -> unit
[<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
[<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}")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the Type of objects being processed cannot be statically discovered.")>]
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

O fluxo onde o formatador coloca os dados serializados. Este fluxo pode referenciar uma variedade de armazenamentos de backup (como ficheiros, rede, memória, etc.).

graph
Object

O objeto, ou raiz do grafo objeto, para serializar. Todos os objetos filhos deste objeto raiz são automaticamente serializados.

Atributos

Observações

O Serialize método serializa automaticamente os objetos fornecidos, e todos os objetos a eles ligados, para o fluxo fornecido.

Por defeito, o processo de serialização regista o estado de um objeto recolhendo os valores de todos os seus campos (públicos e privados). Estes campos são guardados no fluxo juntamente com informações sobre o objeto, como o nome qualificado pela assembleia para o seu tipo.

Aplica-se a

Ver também