共用方式為


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 都會由格式器自動追蹤和序列化。

注意

不保證此方法只會在序列化期間針對每個物件實例呼叫一次。 因此,方法應該以這種方式實作,無論呼叫的次數為何,其行為都會相同。

適用於

另請參閱