ISerializable.GetObjectData(SerializationInfo, StreamingContext) 方法

定义

注意

Formatter-based serialization is obsolete and should not be used.

使用将目标对象序列化所需的数据填充 SerializationInfo

public:
 void GetObjectData(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
public void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("Formatter-based serialization is obsolete and should not be used.", DiagnosticId="SYSLIB0050", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
public void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
abstract member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
[<System.Obsolete("Formatter-based serialization is obsolete and should not be used.", DiagnosticId="SYSLIB0050", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
[<System.Security.SecurityCritical>]
abstract member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
Public Sub GetObjectData (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

要填充数据的 SerializationInfo

context
StreamingContext

此序列化的目标(请参见 StreamingContext)。

属性

例外

调用方没有所要求的权限。

注解

格式化程序会自动跟踪和序列化 中包含的 SerializationInfo 任何对象。

注意

不能保证在序列化期间每个对象实例只调用此方法一次。 因此,无论调用方法的次数如何,方法的实现方式都应相同。

适用于

另请参阅