Formatter Formatter Formatter Formatter Class

定義

重要

此 API 不符合 CLS 規範。

將基本功能提供給 Common Language Runtime 序列化格式子 (Serialization Formatter)。Provides base functionality for the common language runtime serialization formatters.

public ref class Formatter abstract : System::Runtime::Serialization::IFormatter
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
type Formatter = class
    interface IFormatter
Public MustInherit Class Formatter
Implements IFormatter
繼承
FormatterFormatterFormatterFormatter
屬性
實作

備註

Formatterabstract為所有的執行階段序列化格式子的基底類別,並提供一些協助程式方法,來實作IFormatter介面。Formatter is the abstract base class for all runtime serialization formatters, and provides some helper methods for implementing the IFormatter interface. Formatter也會管理佇列的物件進行序列化,並產生每個物件為基礎的識別碼。The Formatter also manages queuing objects for serialization and generating IDs on a per-object basis.

給繼承者的注意事項

當您繼承自Formatter,您必須覆寫下列成員:When you inherit from Formatter, you must override the following members:

建構函式

Formatter() Formatter() Formatter() Formatter()

初始化 Formatter 類別的新執行個體。Initializes a new instance of the Formatter class.

欄位

m_idGenerator m_idGenerator m_idGenerator m_idGenerator

包含與目前的格式子 (Formatter) 使用的 ObjectIDGeneratorContains the ObjectIDGenerator used with the current formatter.

m_objectQueue m_objectQueue m_objectQueue m_objectQueue

包含為了序列化而保留的物件 QueueContains a Queue of the objects left to serialize.

屬性

Binder Binder Binder Binder

當覆寫於衍生類別時,取得或設定與目前的格式子使用的 SerializationBinderWhen overridden in a derived class, gets or sets the SerializationBinder used with the current formatter.

Context Context Context Context

當覆寫於衍生類別時,取得或設定用於目前序列化的 StreamingContextWhen overridden in a derived class, gets or sets the StreamingContext used for the current serialization.

SurrogateSelector SurrogateSelector SurrogateSelector SurrogateSelector

當覆寫於衍生類別時,取得或設定與目前的格式子使用的 ISurrogateSelectorWhen overridden in a derived class, gets or sets the ISurrogateSelector used with the current formatter.

方法

Deserialize(Stream) Deserialize(Stream) Deserialize(Stream) Deserialize(Stream)

當覆寫於衍生類別時,還原序列化建立時即附加至格式子的資料流,建立與原本序列化至資料流之 Graph 相同的物件 Graph。When overridden in a derived class, deserializes the stream attached to the formatter when it was created, creating a graph of objects identical to the graph originally serialized into that stream.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetNext(Int64) GetNext(Int64) GetNext(Int64) GetNext(Int64)

從格式子的內部工作佇列傳回要序列化的下一個物件。Returns the next object to serialize, from the formatter's internal work queue.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
Schedule(Object) Schedule(Object) Schedule(Object) Schedule(Object)

為後續的序列化排程物件。Schedules an object for later serialization.

Serialize(Stream, Object) Serialize(Stream, Object) Serialize(Stream, Object) Serialize(Stream, Object)

當覆寫於衍生類別時,使用已附加於格式子的資料流指定根 (Root),序列化物件的 Graph。When overridden in a derived class, serializes the graph of objects with the specified root to the stream already attached to the formatter.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
WriteArray(Object, String, Type) WriteArray(Object, String, Type) WriteArray(Object, String, Type) WriteArray(Object, String, Type)

當覆寫於衍生類別時,將陣列寫入至已附加於格式子的資料流。When overridden in a derived class, writes an array to the stream already attached to the formatter.

WriteBoolean(Boolean, String) WriteBoolean(Boolean, String) WriteBoolean(Boolean, String) WriteBoolean(Boolean, String)

當覆寫於衍生類別時,將布林值 (Boolean) 寫入至已附加於格式子的資料流。When overridden in a derived class, writes a Boolean value to the stream already attached to the formatter.

WriteByte(Byte, String) WriteByte(Byte, String) WriteByte(Byte, String) WriteByte(Byte, String)

當覆寫於衍生類別時,將 8 位元的不帶正負號整數 (Unsigned Integer) 寫入至已附加於格式子的資料流。When overridden in a derived class, writes an 8-bit unsigned integer to the stream already attached to the formatter.

WriteChar(Char, String) WriteChar(Char, String) WriteChar(Char, String) WriteChar(Char, String)

當覆寫於衍生類別時,將 Unicode 字元寫入至已附加於格式子的資料流。When overridden in a derived class, writes a Unicode character to the stream already attached to the formatter.

WriteDateTime(DateTime, String) WriteDateTime(DateTime, String) WriteDateTime(DateTime, String) WriteDateTime(DateTime, String)

當覆寫於衍生類別時,將 DateTime 值寫入至已附加於格式子的資料流。When overridden in a derived class, writes a DateTime value to the stream already attached to the formatter.

WriteDecimal(Decimal, String) WriteDecimal(Decimal, String) WriteDecimal(Decimal, String) WriteDecimal(Decimal, String)

當覆寫於衍生類別時,將 Decimal 值寫入至已附加於格式子的資料流。When overridden in a derived class, writes a Decimal value to the stream already attached to the formatter.

WriteDouble(Double, String) WriteDouble(Double, String) WriteDouble(Double, String) WriteDouble(Double, String)

當覆寫於衍生類別時,將雙精度浮點數寫入至已附加於格式子的資料流。When overridden in a derived class, writes a double-precision floating-point number to the stream already attached to the formatter.

WriteInt16(Int16, String) WriteInt16(Int16, String) WriteInt16(Int16, String) WriteInt16(Int16, String)

當覆寫於衍生類別時,將 16 位元的帶正負號整數 (Signed Integer) 寫入至已附加於格式子的資料流。When overridden in a derived class, writes a 16-bit signed integer to the stream already attached to the formatter.

WriteInt32(Int32, String) WriteInt32(Int32, String) WriteInt32(Int32, String) WriteInt32(Int32, String)

當覆寫於衍生類別時,將 32 位元的帶正負號整數寫入至資料流。When overridden in a derived class, writes a 32-bit signed integer to the stream.

WriteInt64(Int64, String) WriteInt64(Int64, String) WriteInt64(Int64, String) WriteInt64(Int64, String)

當覆寫於衍生類別時,將 64 位元的帶正負號整數寫入至資料流。When overridden in a derived class, writes a 64-bit signed integer to the stream.

WriteMember(String, Object) WriteMember(String, Object) WriteMember(String, Object) WriteMember(String, Object)

檢查所接收的資料型別,並呼叫適當的 Write 方法,執行對已附加於格式子的資料流寫入。Inspects the type of data received, and calls the appropriate Write method to perform the write to the stream already attached to the formatter.

WriteObjectRef(Object, String, Type) WriteObjectRef(Object, String, Type) WriteObjectRef(Object, String, Type) WriteObjectRef(Object, String, Type)

當覆寫於衍生類別時,將物件參考寫入至已附加於格式子的資料流。When overridden in a derived class, writes an object reference to the stream already attached to the formatter.

WriteSByte(SByte, String) WriteSByte(SByte, String) WriteSByte(SByte, String) WriteSByte(SByte, String)

當覆寫於衍生類別時,將 8 位元的帶正負號整數寫入至已附加於格式子的資料流。When overridden in a derived class, writes an 8-bit signed integer to the stream already attached to the formatter.

WriteSingle(Single, String) WriteSingle(Single, String) WriteSingle(Single, String) WriteSingle(Single, String)

當覆寫於衍生類別時,將單精確度浮點數寫入至已附加於格式子的資料流。When overridden in a derived class, writes a single-precision floating-point number to the stream already attached to the formatter.

WriteTimeSpan(TimeSpan, String) WriteTimeSpan(TimeSpan, String) WriteTimeSpan(TimeSpan, String) WriteTimeSpan(TimeSpan, String)

當覆寫於衍生類別時,將 TimeSpan 值寫入至已附加於格式子的資料流。When overridden in a derived class, writes a TimeSpan value to the stream already attached to the formatter.

WriteUInt16(UInt16, String) WriteUInt16(UInt16, String) WriteUInt16(UInt16, String) WriteUInt16(UInt16, String)

當覆寫於衍生類別時,將 16 位元的不帶正負號整數寫入至已附加於格式子的資料流。When overridden in a derived class, writes a 16-bit unsigned integer to the stream already attached to the formatter.

WriteUInt32(UInt32, String) WriteUInt32(UInt32, String) WriteUInt32(UInt32, String) WriteUInt32(UInt32, String)

當覆寫於衍生類別時,將 32 位元的不帶正負號整數寫入至已附加於格式子的資料流。When overridden in a derived class, writes a 32-bit unsigned integer to the stream already attached to the formatter.

WriteUInt64(UInt64, String) WriteUInt64(UInt64, String) WriteUInt64(UInt64, String) WriteUInt64(UInt64, String)

當覆寫於衍生類別時,將 64 位元的不帶正負號整數寫入至已附加於格式子的資料流。When overridden in a derived class, writes a 64-bit unsigned integer to the stream already attached to the formatter.

WriteValueType(Object, String, Type) WriteValueType(Object, String, Type) WriteValueType(Object, String, Type) WriteValueType(Object, String, Type)

當覆寫於衍生類別時,將指定型別值寫入至已附加於格式子的資料流。When overridden in a derived class, writes a value of the given type to the stream already attached to the formatter.

適用於

另請參閱