Generates IDs for objects. It keeps track of objects already 'seen' so that if you ask for the ID of an object, it knows whether to return its existing ID, or generate (and remember) a new ID.
Object
ObjectIDGenerator
[Visual Basic] Public Class ObjectIDGenerator [C#] public class ObjectIDGenerator [C++] public __gc class ObjectIDGenerator [JScript] public class ObjectIDGenerator
The IDs are unique for the life of the ObjectIDGenerator instance. Normally, this life would span that of the Formatter, which created it. Thus object IDs have meaning only within a given serialized stream. They are used for tracking which objects 'point' to which others within the serialized object graph.
Internally, ObjectIDGenerator 'remembers' which ID it assigned to which object using a hash table. Note that the object references, which uniquely identify each object are addresses in the runtime garbage-collected heap. Their values may therefore change during serialization, but the hash table is updated automatically so that it works correctly.
Note that Object IDs are 64-bit numbers. Allocation starts from 1. Zero is never a valid Object ID. (A formatter may therefore choose a zero value as how it represents an object reference whose value is null).
Namespace: System.Runtime.Serialization
Assembly: mscorlib.dll
ObjectIDGenerator Members | System.Runtime.Serialization Namespace