Formatter Formatter Formatter Formatter Class

定义

重要

此 API 不符合 CLS。

提供公共语言运行时序列化格式化程序的基本功能。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
属性
实现

注解

Formatter是所有abstract运行时序列化格式化程序的基类,并提供一些用于IFormatter实现接口的帮助器方法。Formatter is the abstract base class for all runtime serialization formatters, and provides some helper methods for implementing the IFormatter interface. Formatter还管理用于序列化的排队对象并基于每个对象生成 id。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

包含与当前格式化程序一起使用的 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)

当在派生类中重写时,将连接到格式化程序的流反序列化(在创建该流时),以创建与最初序列化为该流的图形相同的对象图形。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 的浅表副本。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)

当在派生类中重写时,将具有指定根的对象图形序列化为已经连接到格式化程序的流。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 位无符号整数。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 位有符号整数。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.

适用于

另请参阅