Edit

Share via


ObjectManager.RegisterObject Method

Definition

Registers an object as it is deserialized.

Overloads

RegisterObject(Object, Int64)

Registers an object as it is deserialized, associating it with objectID.

RegisterObject(Object, Int64, SerializationInfo)

Registers an object as it is deserialized, associating it with objectID, and recording the SerializationInfo used with it.

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

Registers a member of an object as it is deserialized, associating it with objectID, and recording the SerializationInfo.

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

Registers a member of an array contained in an object while it is deserialized, associating it with objectID, and recording the SerializationInfo.

RegisterObject(Object, Int64)

Source:
ObjectManager.cs
Source:
ObjectManager.cs
Source:
ObjectManager.cs

Registers an object as it is deserialized, associating it with objectID.

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

Parameters

obj
Object

The object to register.

objectID
Int64

The ID of the object to register.

Attributes

Exceptions

The obj parameter is null.

The objectID parameter is less than or equal to zero.

The objectID has already been registered for an object other than obj.

Remarks

ObjectManager retains information about both the object and its ID. 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.

Applies to

RegisterObject(Object, Int64, SerializationInfo)

Source:
ObjectManager.cs
Source:
ObjectManager.cs
Source:
ObjectManager.cs

Registers 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);
public void RegisterObject (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
[<System.Security.SecurityCritical>]
member this.RegisterObject : obj * int64 * System.Runtime.Serialization.SerializationInfo -> unit
Public Sub RegisterObject (obj As Object, objectID As Long, info As SerializationInfo)

Parameters

obj
Object

The object to register.

objectID
Int64

The ID of the object to register.

info
SerializationInfo

The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info will be completed with any required fixup information and then passed to the required object when that object is completed.

Attributes

Exceptions

The obj parameter is null.

The objectID parameter is less than or equal to zero.

The objectID has already been registered for an object other than obj.

Remarks

ObjectManager retains the information about both the object and its 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.

Applies to

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

Source:
ObjectManager.cs
Source:
ObjectManager.cs
Source:
ObjectManager.cs

Registers 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);
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo? info, long idOfContainingObj, System.Reflection.MemberInfo? member);
public void RegisterObject (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
[<System.Security.SecurityCritical>]
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)

Parameters

obj
Object

The object to register.

objectID
Int64

The ID of the object to register.

info
SerializationInfo

The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info will be completed with any required fixup information and then passed to the required object when that object is completed.

idOfContainingObj
Int64

The ID of the object that contains obj. This parameter is required only if obj is a value type.

member
MemberInfo

The field in the containing object where obj exists. This parameter has meaning only if obj is a value type.

Attributes

Exceptions

The obj parameter is null.

The objectID parameter is less than or equal to zero.

The objectID has already been registered for an object other than obj, or member is not a FieldInfo and member is not null.

Remarks

You need to provide the member and idOfContainingObj parameters if obj is a ValueType because of the way fixups are performed on ValueType objects. The space to store the information for a ValueType is allocated inline with its containing object. However, when the ValueType is boxed to be registered with the ObjectManager, it loses the connection with its containing object. 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 retains information about both the object and its ID. 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.

Applies to

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

Source:
ObjectManager.cs
Source:
ObjectManager.cs
Source:
ObjectManager.cs

Registers 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);
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo? info, long idOfContainingObj, System.Reflection.MemberInfo? member, int[]? arrayIndex);
public void RegisterObject (object obj, long objectID, System.Runtime.Serialization.SerializationInfo info, long idOfContainingObj, System.Reflection.MemberInfo member, 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
[<System.Security.SecurityCritical>]
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())

Parameters

obj
Object

The object to register.

objectID
Int64

The ID of the object to register.

info
SerializationInfo

The SerializationInfo used if obj implements ISerializable or has a ISerializationSurrogate. info will be completed with any required fixup information and then passed to the required object when that object is completed.

idOfContainingObj
Int64

The ID of the object that contains obj. This parameter is required only if obj is a value type.

member
MemberInfo

The field in the containing object where obj exists. This parameter has meaning only if obj is a value type.

arrayIndex
Int32[]

If obj is a ValueType and a member of an array, arrayIndex contains the index within that array where obj exists. arrayIndex is ignored if obj is not both a ValueType and a member of an array.

Attributes

Exceptions

The obj parameter is null.

The objectID parameter is less than or equal to zero.

The objectID has already been registered for an object other than obj, or member is not a FieldInfo and member isn't null.

Remarks

You need to provide the member and idOfContainingObj parameters if obj is a ValueType because of the way fixups are performed on ValueType objects. The space to store the information for a ValueType is allocated inline with its containing object. However, when the ValueType is boxed to be registered with the ObjectManager, it loses the connection with its containing object. 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 retains information about both the object and its ID. 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.

Applies to