ObjectManager.RegisterObject ObjectManager.RegisterObject ObjectManager.RegisterObject ObjectManager.RegisterObject Method

定義

在物件還原序列化時登錄該物件。Registers an object as it is deserialized.

多載

RegisterObject(Object, Int64) RegisterObject(Object, Int64) RegisterObject(Object, Int64) RegisterObject(Object, Int64)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯。Registers an object as it is deserialized, associating it with objectID.

RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯,並記錄和它一起使用的 SerializationInfoRegisters an object as it is deserialized, associating it with objectID, and recording the SerializationInfo used with it.

RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯,並記錄 SerializationInfoRegisters a member of an object as it is deserialized, associating it with objectID, and recording the SerializationInfo.

RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[])

當物件還原序列化時,登錄物件中所包含的陣列成員,將它與 objectID 相關聯,並記錄 SerializationInfoRegisters a member of an array contained in an object while it is deserialized, associating it with objectID, and recording the SerializationInfo.

RegisterObject(Object, Int64) RegisterObject(Object, Int64) RegisterObject(Object, Int64) RegisterObject(Object, Int64)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯。Registers an object as it is deserialized, associating it with objectID.

public:
 virtual void RegisterObject(System::Object ^ obj, long objectID);
[System.Security.SecurityCritical]
public virtual void RegisterObject (object obj, long objectID);
abstract member RegisterObject : obj * int64 -> unit
override this.RegisterObject : obj * int64 -> unit
Public Overridable Sub RegisterObject (obj As Object, objectID As Long)

參數

obj
Object Object Object Object

要登錄的物件。The object to register.

objectID
Int64 Int64 Int64 Int64

要登錄的物件 ID。The ID of the object to register.

例外狀況

objectID 參數小於或等於零。The objectID parameter is less than or equal to zero.

objectID 已經為 obj 以外的物件進行登錄。The objectID has already been registered for an object other than obj.

備註

ObjectManager 會保留資訊物件,其識別碼。ObjectManager retains information about both the object and its ID. 還原序列化期間,更新GetObject可用來判斷是否已還原序列化特定物件識別碼,或它是否向前參考不尚未已還原序列化的物件。Later during deserialization, GetObject can be used to determine whether a particular object ID has already been deserialized, or whether it is a forward reference to an object that has not yet been deserialized.

RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo) RegisterObject(Object, Int64, SerializationInfo)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯,並記錄和它一起使用的 SerializationInfoRegisters an object as it is deserialized, associating it with objectID, and recording the SerializationInfo used with it.

public:
 void RegisterObject(System::Object ^ obj, long objectID, System::Runtime::Serialization::SerializationInfo ^ info);
[System.Security.SecurityCritical]
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo info);
member this.RegisterObject : obj * int64 * System.Runtime.Serialization.SerializationInfo -> unit
Public Sub RegisterObject (obj As Object, objectID As Long, info As SerializationInfo)

參數

obj
Object Object Object Object

要登錄的物件。The object to register.

objectID
Int64 Int64 Int64 Int64

要登錄的物件 ID。The ID of the object to register.

info
SerializationInfo SerializationInfo SerializationInfo SerializationInfo

SerializationInfo,用於 obj 實作 ISerializable 或具有 ISerializationSurrogate 時。The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info 將使用任何必要的修復資訊來完成,然後在必要的物件完成時傳遞給該物件。info will be completed with any required fixup information and then passed to the required object when that object is completed.

例外狀況

objectID 參數小於或等於零。The objectID parameter is less than or equal to zero.

objectID 已經為 obj 以外的物件進行登錄。The objectID has already been registered for an object other than obj.

備註

ObjectManager 會保留資訊物件,其識別碼。ObjectManager retains the information about both the object and its ID. 稍後在還原序列化時,您可以使用GetObject來探索是否已還原序列化 ID,一個特定物件,或者它是向前參考不尚未已還原序列化的物件。Later during deserialization, you can use GetObject to discover whether a particular object ID has already been deserialized, or if it is a forward reference to an object that has not yet been deserialized.

RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo)

在物件還原序列化時登錄該物件,將它與 objectID 相關聯,並記錄 SerializationInfoRegisters a member of an object as it is deserialized, associating it with objectID, and recording the SerializationInfo.

public:
 void RegisterObject(System::Object ^ obj, long objectID, System::Runtime::Serialization::SerializationInfo ^ info, long idOfContainingObj, System::Reflection::MemberInfo ^ member);
[System.Security.SecurityCritical]
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo info, long idOfContainingObj, System.Reflection.MemberInfo member);
member this.RegisterObject : obj * int64 * System.Runtime.Serialization.SerializationInfo * int64 * System.Reflection.MemberInfo -> unit
Public Sub RegisterObject (obj As Object, objectID As Long, info As SerializationInfo, idOfContainingObj As Long, member As MemberInfo)

參數

obj
Object Object Object Object

要登錄的物件。The object to register.

objectID
Int64 Int64 Int64 Int64

要登錄的物件 ID。The ID of the object to register.

info
SerializationInfo SerializationInfo SerializationInfo SerializationInfo

SerializationInfo,用於 obj 實作 ISerializable 或具有 ISerializationSurrogate 時。The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info 將使用任何必要的修復資訊來完成,然後在必要的物件完成時傳遞給該物件。info will be completed with any required fixup information and then passed to the required object when that object is completed.

idOfContainingObj
Int64 Int64 Int64 Int64

包含 obj 的物件 ID。The ID of the object that contains obj. 只有當 obj 是實值型別時,才需要這個參數。This parameter is required only if obj is a value type.

member
MemberInfo MemberInfo MemberInfo MemberInfo

包含物件中的欄位,其中有 obj 存在。The field in the containing object where obj exists. 只有當 obj 是實值型別時,這個參數才有意義。This parameter has meaning only if obj is a value type.

例外狀況

objectID 參數小於或等於零。The objectID parameter is less than or equal to zero.

objectID 已經為 obj 以外的物件進行登錄,或者 member 不是 FieldInfo,而且 member 不是 nullThe objectID has already been registered for an object other than obj, or member is not a FieldInfo and member is not null.

備註

您必須提供memberidOfContainingObj參數如果objValueType由於方式上執行修復ValueType物件。You need to provide the member and idOfContainingObj parameters if obj is a ValueType because of the way fixups are performed on ValueType objects. 若要儲存的資訊空間ValueType配置內嵌於其包含的物件。The space to store the information for a ValueType is allocated inline with its containing object. 不過,當ValueType會進行 boxed 處理向ObjectManager,就會失去與包含物件的連接。However, when the ValueType is boxed to be registered with the ObjectManager, it loses the connection with its containing object. 若要保證修復發生的執行個體中ValueType儲存在包含的物件而非經過 boxing 處理的執行個體,ObjectManager會保留一些額外資訊。To guarantee that fixups occur in the instance of the ValueType stored in the containing object and not in the boxed instance, the ObjectManager retains some additional information.

ObjectManager 會保留資訊物件,其識別碼。ObjectManager retains information about both the object and its ID. 還原序列化期間,更新GetObject可用來探索是否已還原序列化特定物件識別碼,或它是否不是向前參考的物件尚未還原序列化。Later during deserialization, GetObject can be used to discover whether a particular object ID has already been deserialized, or whether it is a forward reference to an object not yet deserialized.

RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[]) RegisterObject(Object, Int64, SerializationInfo, Int64, MemberInfo, Int32[])

當物件還原序列化時,登錄物件中所包含的陣列成員,將它與 objectID 相關聯,並記錄 SerializationInfoRegisters a member of an array contained in an object while it is deserialized, associating it with objectID, and recording the SerializationInfo.

public:
 void RegisterObject(System::Object ^ obj, long objectID, System::Runtime::Serialization::SerializationInfo ^ info, long idOfContainingObj, System::Reflection::MemberInfo ^ member, cli::array <int> ^ arrayIndex);
[System.Security.SecurityCritical]
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo info, long idOfContainingObj, System.Reflection.MemberInfo member, int[] arrayIndex);
member this.RegisterObject : obj * int64 * System.Runtime.Serialization.SerializationInfo * int64 * System.Reflection.MemberInfo * int[] -> unit
Public Sub RegisterObject (obj As Object, objectID As Long, info As SerializationInfo, idOfContainingObj As Long, member As MemberInfo, arrayIndex As Integer())

參數

obj
Object Object Object Object

要登錄的物件。The object to register.

objectID
Int64 Int64 Int64 Int64

要登錄的物件 ID。The ID of the object to register.

info
SerializationInfo SerializationInfo SerializationInfo SerializationInfo

SerializationInfo,用於 obj 實作 ISerializable 或具有 ISerializationSurrogate 時。The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info 將使用任何必要的修復資訊來完成,然後在必要的物件完成時傳遞給該物件。info will be completed with any required fixup information and then passed to the required object when that object is completed.

idOfContainingObj
Int64 Int64 Int64 Int64

包含 obj 的物件 ID。The ID of the object that contains obj. 只有當 obj 是實值型別時,才需要這個參數。This parameter is required only if obj is a value type.

member
MemberInfo MemberInfo MemberInfo MemberInfo

包含物件中的欄位,其中有 obj 存在。The field in the containing object where obj exists. 只有當 obj 是實值型別時,這個參數才有意義。This parameter has meaning only if obj is a value type.

arrayIndex
Int32[]

如果 objValueType 並且是陣列的成員,arrayIndex 會包含該陣列 (有 obj 存在) 中的索引。If obj is a ValueType and a member of an array, arrayIndex contains the index within that array where obj exists. 如果 arrayIndex 不是 ValueType 並且不是陣列的成員,則會忽略 objarrayIndex is ignored if obj is not both a ValueType and a member of an array.

例外狀況

objectID 參數小於或等於零。The objectID parameter is less than or equal to zero.

objectID 已經為 obj 以外的物件進行登錄,或者 member 不是 FieldInfo,而且 member 不是 nullThe objectID has already been registered for an object other than obj, or member is not a FieldInfo and member isn't null.

備註

您必須提供memberidOfContainingObj參數如果objValueType由於方式上執行修復ValueType物件。You need to provide the member and idOfContainingObj parameters if obj is a ValueType because of the way fixups are performed on ValueType objects. 若要儲存的資訊空間ValueType配置內嵌於其包含的物件。The space to store the information for a ValueType is allocated inline with its containing object. 不過,當ValueType會進行 boxed 處理向ObjectManager,就會失去與包含物件的連接。However, when the ValueType is boxed to be registered with the ObjectManager, it loses the connection with its containing object. 若要保證修復發生的執行個體中ValueType儲存在包含的物件而非經過 boxing 處理的執行個體,ObjectManager會保留一些額外資訊。To guarantee that fixups occur in the instance of the ValueType stored in the containing object and not in the boxed instance, the ObjectManager retains some additional information.

ObjectManager 會保留資訊物件,其識別碼。ObjectManager retains information about both the object and its ID. 還原序列化期間,更新GetObject可用來探索是否已還原序列化特定物件識別碼,或它是否不是向前參考的物件尚未還原序列化。Later during deserialization, GetObject can be used to discover whether a particular object ID has already been deserialized, or whether it is a forward reference to an object not yet deserialized.

適用於