IFormatter.Serialize(Stream, Object) Metódus

Definíció

Figyelemfelhívás

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

Szerializál egy objektumot vagy objektumdiagramot a megadott adatfolyam adott gyökerével.

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)

Paraméterek

serializationStream
Stream

Az a stream, amelyben a formázó elhelyezi a szerializált adatokat. Ez a stream számos háttértárra hivatkozhat (például fájlokra, hálózatra, memóriára stb.).

graph
Object

Az objektumdiagram szerializálandó objektuma vagy gyökere. A gyökérobjektum összes gyermekobjektuma automatikusan szerializálva lesz.

Attribútumok

Megjegyzések

A Serialize metódus automatikusan szerializálja a megadott objektumokat, valamint az ahhoz kapcsolódó összes objektumot a megadott streamhez.

Alapértelmezés szerint a szerializálási folyamat rögzíti az objektumok állapotát az összes (nyilvános és privát) mező értékeinek összegyűjtésével. Ezeket a mezőket a rendszer menti a streambe, valamint az objektumra vonatkozó információkat, például a szerelvény által a típusához minősített nevet.

A következőre érvényes:

Lásd még