Formatter 類別

定義

警告

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

重要

此 API 不符合 CLS 規範。

將基本功能提供給 Common Language Runtime 序列化格式子 (Serialization Formatter)。

public ref class Formatter abstract : System::Runtime::Serialization::IFormatter
[System.CLSCompliant(false)]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[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 abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[System.Serializable]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[<System.CLSCompliant(false)>]
type Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<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 Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<System.Serializable>]
type Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Formatter = class
    interface IFormatter
Public MustInherit Class Formatter
Implements IFormatter
繼承
Formatter
屬性
實作

備註

Formatterabstract是所有執行時間序列化格式子的基類,並提供一些實作 介面的 IFormatter 協助程式方法。 Formatter也會管理佇列物件,以便依每個物件進行序列化和產生識別碼。

給實施者的注意事項

當您繼承自 Formatter 時,必須覆寫下列成員:

建構函式

Formatter()
已淘汰.

初始化 Formatter 類別的新執行個體。

欄位

m_idGenerator
已淘汰.

包含與目前的格式子 (Formatter) 使用的 ObjectIDGenerator

m_objectQueue
已淘汰.

包含為了序列化而保留的物件 Queue

屬性

Binder
已淘汰.

當覆寫於衍生類別時,取得或設定與目前的格式子使用的 SerializationBinder

Context
已淘汰.

當覆寫於衍生類別時,取得或設定用於目前序列化的 StreamingContext

SurrogateSelector
已淘汰.

當覆寫於衍生類別時,取得或設定與目前的格式子使用的 ISurrogateSelector

方法

Deserialize(Stream)
已淘汰.

當覆寫於衍生類別時,還原序列化建立時即附加至格式子的資料流,建立與原本序列化至資料流之 Graph 相同的物件 Graph。

Equals(Object)
已淘汰.

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

(繼承來源 Object)
GetHashCode()
已淘汰.

做為預設雜湊函式。

(繼承來源 Object)
GetNext(Int64)
已淘汰.

從格式子的內部工作佇列傳回要序列化的下一個物件。

GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
Schedule(Object)
已淘汰.

為後續的序列化排程物件。

Serialize(Stream, Object)
已淘汰.

當覆寫於衍生類別時,使用已附加於格式子的資料流指定根 (Root),序列化物件的 Graph。

ToString()
已淘汰.

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

(繼承來源 Object)
WriteArray(Object, String, Type)
已淘汰.

當覆寫於衍生類別時,將陣列寫入至已附加於格式子的資料流。

WriteBoolean(Boolean, String)
已淘汰.

當覆寫於衍生類別時,將布林值 (Boolean) 寫入至已附加於格式子的資料流。

WriteByte(Byte, String)
已淘汰.

當覆寫於衍生類別時,將 8 位元的不帶正負號整數 (Unsigned Integer) 寫入至已附加於格式子的資料流。

WriteChar(Char, String)
已淘汰.

當覆寫於衍生類別時,將 Unicode 字元寫入至已附加於格式子的資料流。

WriteDateTime(DateTime, String)
已淘汰.

當覆寫於衍生類別時,將 DateTime 值寫入至已附加於格式子的資料流。

WriteDecimal(Decimal, String)
已淘汰.

當覆寫於衍生類別時,將 Decimal 值寫入至已附加於格式子的資料流。

WriteDouble(Double, String)
已淘汰.

當覆寫於衍生類別時,將雙精度浮點數寫入至已附加於格式子的資料流。

WriteInt16(Int16, String)
已淘汰.

當覆寫於衍生類別時,將 16 位元的帶正負號整數 (Signed Integer) 寫入至已附加於格式子的資料流。

WriteInt32(Int32, String)
已淘汰.

當覆寫於衍生類別時,將 32 位元的帶正負號整數寫入至資料流。

WriteInt64(Int64, String)
已淘汰.

當覆寫於衍生類別時,將 64 位元的帶正負號整數寫入至資料流。

WriteMember(String, Object)
已淘汰.

檢查所接收的資料型別,並呼叫適當的 Write 方法,執行對已附加於格式子的資料流寫入。

WriteObjectRef(Object, String, Type)
已淘汰.

當覆寫於衍生類別時,將物件參考寫入至已附加於格式子的資料流。

WriteSByte(SByte, String)
已淘汰.

當覆寫於衍生類別時,將 8 位元的帶正負號整數寫入至已附加於格式子的資料流。

WriteSingle(Single, String)
已淘汰.

當覆寫於衍生類別時,將單精確度浮點數寫入至已附加於格式子的資料流。

WriteTimeSpan(TimeSpan, String)
已淘汰.

當覆寫於衍生類別時,將 TimeSpan 值寫入至已附加於格式子的資料流。

WriteUInt16(UInt16, String)
已淘汰.

當覆寫於衍生類別時,將 16 位元的不帶正負號整數寫入至已附加於格式子的資料流。

WriteUInt32(UInt32, String)
已淘汰.

當覆寫於衍生類別時,將 32 位元的不帶正負號整數寫入至已附加於格式子的資料流。

WriteUInt64(UInt64, String)
已淘汰.

當覆寫於衍生類別時,將 64 位元的不帶正負號整數寫入至已附加於格式子的資料流。

WriteValueType(Object, String, Type)
已淘汰.

當覆寫於衍生類別時,將指定型別值寫入至已附加於格式子的資料流。

適用於

另請參閱