IFormatter.Serialize(Stream, Object) Metod

Definition

Varning

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

Serialiserar ett objekt eller ett diagram över objekt med den angivna roten till den angivna strömmen.

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)

Parametrar

serializationStream
Stream

Strömmen där formateren placerar serialiserade data. Den här strömmen kan referera till en mängd olika lagringsplatser (till exempel filer, nätverk, minne och så vidare).

graph
Object

Objektet, eller roten i objektdiagrammet, som ska serialiseras. Alla underordnade objekt i det här rotobjektet serialiseras automatiskt.

Attribut

Kommentarer

Metoden Serialize serialiserar automatiskt de angivna objekten och alla objekt som är anslutna till den till den angivna strömmen.

Som standard registrerar serialiseringsprocessen ett objekts tillstånd genom att samla in värdena för alla dess fält (offentliga och privata). Dessa fält sparas i dataströmmen tillsammans med information om objektet, till exempel namnet som kvalificerats av sammansättningen för dess typ.

Gäller för

Se även