Formatter 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.
重要
此 API 不符合 CLS。
提供公共语言运行时序列化格式化程序的基本功能。
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 IFormatterPublic MustInherit Class Formatter
Implements IFormatter- 继承
- 
				Formatter
- 属性
- 实现
注解
              Formatter
              abstract是所有运行时序列化格式化程序的基类,并提供一些用于实现 接口的IFormatter帮助程序方法。 
              Formatter还管理序列化的队列对象,并基于每个对象生成 ID。
实施者说明
从 Formatter继承时,必须重写以下成员:
构造函数
| Formatter() | 
				已过时.
			 初始化 Formatter 类的新实例。 | 
字段
| m_idGenerator | 
				已过时.
			 包含与当前格式化程序一起使用的 ObjectIDGenerator。 | 
| m_objectQueue | 
				已过时.
			 包含要序列化的对象的 Queue。 | 
属性
| Binder | 
				已过时.
			 当在派生类中重写时,获取或设置与当前格式化程序一起使用的 SerializationBinder。 | 
| Context | 
				已过时.
			 当在派生类中重写时,获取或设置用于当前序列化的 StreamingContext。 | 
| SurrogateSelector | 
				已过时.
			 当在派生类中重写时,获取或设置与当前格式化程序一起使用的 ISurrogateSelector。 | 
方法
| Deserialize(Stream) | 
				已过时.
			 当在派生类中重写时,将连接到格式化程序的流反序列化(在创建该流时),以创建与最初序列化为该流的图形相同的对象图形。 | 
| Equals(Object) | 
		已过时.
	 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetHashCode() | 
		已过时.
	 作为默认哈希函数。(继承自 Object) | 
| GetNext(Int64) | 
				已过时.
			 从格式化程序的内部工作队列返回下一个要序列化的对象。 | 
| GetType() | 
		已过时.
	 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 
		已过时.
	 创建当前 Object 的浅表副本。(继承自 Object) | 
| Schedule(Object) | 
				已过时.
			 安排对象在稍后进行序列化。 | 
| Serialize(Stream, Object) | 
				已过时.
			 当在派生类中重写时,将具有指定根的对象图形序列化为已经连接到格式化程序的流。 | 
| ToString() | 
		已过时.
	 返回表示当前对象的字符串。(继承自 Object) | 
| WriteArray(Object, String, Type) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个数组。 | 
| WriteBoolean(Boolean, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 Boolean 值。 | 
| WriteByte(Byte, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 8 位无符号整数。 | 
| WriteChar(Char, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 Unicode 字符。 | 
| WriteDateTime(DateTime, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 DateTime 值。 | 
| WriteDecimal(Decimal, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 Decimal 值。 | 
| WriteDouble(Double, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个双精度浮点数字。 | 
| WriteInt16(Int16, String) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入一个 16 位有符号整数。 | 
| WriteInt32(Int32, String) | 
				已过时.
			 当在派生类中重写时,向流中写入一个 32 位有符号整数。 | 
| WriteInt64(Int64, String) | 
				已过时.
			 当在派生类中重写时,向流中写入一个 64 位有符号整数。 | 
| WriteMember(String, Object) | 
				已过时.
			 检查所接收的数据的类型,并调用相应的  | 
| 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) | 
				已过时.
			 当在派生类中重写时,向已经连接到格式化程序的流中写入给定类型的值。 |