BinaryFormatter 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 BinaryFormatter 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| BinaryFormatter() |
使用默认值初始化类的新实例 BinaryFormatter 。 |
| BinaryFormatter(ISurrogateSelector, StreamingContext) |
使用给定代理 BinaryFormatter 项选择器和流式处理上下文初始化类的新实例。 |
BinaryFormatter()
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
使用默认值初始化类的新实例 BinaryFormatter 。
public:
BinaryFormatter();
public BinaryFormatter();
Public Sub New ()
注解
Warning
BinaryFormatter 不安全,无法确保安全。 有关详细信息,请参阅 BinaryFormatter 安全指南。
此构造函数按如下所示设置 BinaryFormatter 对象的属性:
| 属性类型 | 条件 |
|---|---|
| SurrogateSelector | null |
| Context | StreamingContext一个值,指示序列化的数据可以传输到任何其他上下文或从任何其他上下文接收。 (StreamingContextStates.All) |
适用于
BinaryFormatter(ISurrogateSelector, StreamingContext)
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
- Source:
- BinaryFormatter.cs
使用给定代理 BinaryFormatter 项选择器和流式处理上下文初始化类的新实例。
public:
BinaryFormatter(System::Runtime::Serialization::ISurrogateSelector ^ selector, System::Runtime::Serialization::StreamingContext context);
public BinaryFormatter(System.Runtime.Serialization.ISurrogateSelector? selector, System.Runtime.Serialization.StreamingContext context);
public BinaryFormatter(System.Runtime.Serialization.ISurrogateSelector selector, System.Runtime.Serialization.StreamingContext context);
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.ISurrogateSelector * System.Runtime.Serialization.StreamingContext -> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Public Sub New (selector As ISurrogateSelector, context As StreamingContext)
参数
- selector
- ISurrogateSelector
要使用的 ISurrogateSelector 。 可以为 null。
- context
- StreamingContext
序列化数据的源和目标。
注解
Warning
BinaryFormatter 不安全,无法确保安全。 有关详细信息,请参阅 BinaryFormatter 安全指南。
初始化指定 BinaryFormatter 对象序列化或反序列化的新 Stream对象。
序列化或反序列化过程使用指定的 ISurrogateSelector 来搜索为要反序列化的对象类型注册的代理项。 代理项是序列化和反序列化特定类对象的帮助程序。 默认值 ISurrogateSelector 无法处理从远程 MarshalByRefObject 处理目的派生的对象序列化。 在远程处理情况下,指定的ISurrogateSelector对象将替换为MarshalByRefObjectObjRef由指定代理项选择器序列化的对象。 因此,如果要使用远程对象,请将 selector 参数设置为实例 RemotingSurrogateSelector。 如果不需要代理项,请将