IFormatter 介面

定義

警告

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

提供用於格式化已序列化物件的功能。

public interface class IFormatter
public interface IFormatter
[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 interface IFormatter
[System.Runtime.InteropServices.ComVisible(true)]
public interface IFormatter
type IFormatter = interface
[<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}")>]
type IFormatter = interface
[<System.Runtime.InteropServices.ComVisible(true)>]
type IFormatter = interface
Public Interface IFormatter
衍生
屬性

備註

此介面必須由架構中 System.Runtime.Serialization 識別為格式器的任何類別實作。

控制其本身序列化的物件可以藉由實作 ISerializable 介面來執行此動作。 若要序列化物件,您必須將該物件標示為可序列化。 您可以將可序列化屬性套用至類別,以執行此動作。 如果圖形中的任何物件無法序列化,序列化將會失敗。

給實施者的注意事項

所有格式器都必須實作這個介面。 用來 Serialize(Stream, Object) 序列化物件或物件的圖形。 使用 Deserialize(Stream) 還原序列化資料流程,並建立物件原始物件或圖形的複製品。

屬性

Binder
已淘汰.

取得或設定在還原序列化 (Deserialization) 期間執行型別查閱的 SerializationBinder

Context
已淘汰.

取得或設定用於序列化和還原序列化的 StreamingContext

SurrogateSelector
已淘汰.

取得或設定目前格式子所使用的 SurrogateSelector

方法

Deserialize(Stream)
已淘汰.

還原序列化在提供的資料流上的資料,並重新組合物件 Graph。

Serialize(Stream, Object)
已淘汰.

使用所提供資料流的指定根序列化物件或物件 Graph。

適用於

另請參閱