BinaryFormatter 類別

定義

以二進位格式序列化與反序列化一個物件,或整個連接物件的圖。

public ref class BinaryFormatter sealed : System::Runtime::Remoting::Messaging::IRemotingFormatter
public ref class BinaryFormatter sealed : System::Runtime::Serialization::IFormatter
public sealed class BinaryFormatter : System.Runtime.Remoting.Messaging.IRemotingFormatter
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class BinaryFormatter : System.Runtime.Remoting.Messaging.IRemotingFormatter
public sealed class BinaryFormatter : System.Runtime.Serialization.IFormatter
type BinaryFormatter = class
    interface IRemotingFormatter
    interface IFormatter
[<System.Runtime.InteropServices.ComVisible(true)>]
type BinaryFormatter = class
    interface IRemotingFormatter
    interface IFormatter
type BinaryFormatter = class
    interface IFormatter
Public NotInheritable Class BinaryFormatter
Implements IRemotingFormatter
Public NotInheritable Class BinaryFormatter
Implements IFormatter
繼承
BinaryFormatter
屬性
實作

備註

警告:BinaryFormatter 不安全,無法被保護。 如需詳細資訊,請參閱 BinaryFormatter 安全性指南。 BinaryFormatter 的內建實作在 .NET 9 中被移除。 欲了解更多資訊,請參閱 BinaryFormatter 遷移指南

建構函式

名稱 Description
BinaryFormatter()

初始化一個以預設值的新類別實例 BinaryFormatter

BinaryFormatter(ISurrogateSelector, StreamingContext)

初始化一個新的類別實例 BinaryFormatter ,並使用指定的代理選擇器與串流上下文。

屬性

名稱 Description
AssemblyFormat

取得或設定解序列器在尋找與載入組件時的行為。

Binder

(不安全感)取得或設定一個型別 SerializationBinder 的物件,控制序列化物件與型別的綁定。

Context

取得或設定 StreamingContext 這個格式化器。

FilterLevel

取得或設定TypeFilterLevel自動反序列化的執行。BinaryFormatter

SurrogateSelector

取得或設定 一個 ISurrogateSelector ,控制序列化與反序列化期間的型別替換。

TypeFormat

取得或設定序列化串流中型別描述的格式。

方法

名稱 Description
Deserialize(Stream, HeaderHandler)

將指定的串流反序列化成物件圖。 提供的 HeaderHandler 會處理該串流中的任何標頭。

Deserialize(Stream)

將指定的串流反序列化成物件圖。

DeserializeMethodResponse(Stream, HeaderHandler, IMethodCallMessage)

從提供的 Stream中,對遠端方法呼叫的回應反序列化。

Equals(Object)

判斷指定的 物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
Serialize(Stream, Object, Header[])

將物件或物件圖,將指定的頂端(根)序列化到附加標頭的給定串流上。

Serialize(Stream, Object)

將物件或具有指定頂端(根節點)的物件圖序列化到給定的串流。

ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)
UnsafeDeserialize(Stream, HeaderHandler)

將指定的串流反序列化成物件圖。 提供的 HeaderHandler 會處理該串流中的任何標頭。

UnsafeDeserializeMethodResponse(Stream, HeaderHandler, IMethodCallMessage)

從提供的 Stream中,對遠端方法呼叫的回應反序列化。

適用於