System.Runtime.Serialization.IObjectReference Interface

Assembly: Mscorlib.dll
Namespace: System.Runtime.Serialization
Summary
Indicates that the current interface implementer is a reference to another object.
C# Syntax:
public interface IObjectReference
Remarks


Notes to implementors: Implement this interface on objects that are references to a different object, which cannot be resolved until the current object is completely restored. During the fixup stage, any object implementing IObjectReference is queried for its real object and that object is inserted into the graph. Fixup refers to the process of finalizing references not already completed during the object deserialization process.
See also:
System.Runtime.Serialization Namespace

System.Runtime.Serialization.IObjectReference Member List:

Public Methods
GetRealObject Returns the real object that should be deserialized, rather than the object that the serialized stream specifies.

System.Runtime.Serialization.IObjectReference Member Details

Method: GetRealObject(
   StreamingContext context
)
Summary
Returns the real object that should be deserialized, rather than the object that the serialized stream specifies.
C# Syntax:
object GetRealObject(
   StreamingContext context
);
Parameters:

context

The StreamingContext from which the current object is deserialized.

Return Value:
Returns the actual object that is put into the graph.
Remarks
This method is useful in a remoting situation where you serialize a proxy-creator object, not an actual object. When the proxy-creator object is deserialized, deserialization calls its IObjectReference.GetRealObject method. At this point, the proxy-creator object creates a new instance of the proxy object that refers back to the original actual object, perhaps on a remote computer. Finally, the proxy-creator object is discarded and reclaimed later by garbage collection.

For example, consider how Type objects are serialized. Instead of transmitting the data from the Type object, the system transmits a holder object with the name of the type object and information on the assembly where it is found in an object implementing IObjectReference. When both the type name and assembly name are available, the deserialization infrastructure calls IObjectReference.GetRealObject on the holder object that has been transmitted. This holder returns the Type object that is inserted into the graph.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.