Export (0) Print
Expand All

ObjectIDGenerator Class

Generates IDs for objects.

For a list of all members of this type, see ObjectIDGenerator Members.

System.Object
   System.Runtime.Serialization.ObjectIDGenerator

[Visual Basic]
<Serializable>
Public Class ObjectIDGenerator
[C#]
[Serializable]
public class ObjectIDGenerator
[C++]
[Serializable]
public __gc class ObjectIDGenerator
[JScript]
public
   Serializable
class ObjectIDGenerator

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

The ObjectIDGenerator keeps track of previously identified objects. When you ask for the ID of an object, the ObjectIDGenerator knows whether to return the existing ID, or generate and remember a new ID.

The IDs are unique for the life of the ObjectIDGenerator instance. Generally, an ObjectIDGenerator life lasts as long as the Formatter that created it. Object IDs have meaning only within a given serialized stream, and are used for tracking which objects have references to others within the serialized object graph.

Using a hash table, the ObjectIDGenerator retains what ID is assigned to what object. The object references, which uniquely identify each object, are addresses in the runtime garbage-collected heap. Object reference values can change during serialization, but the table is updated automatically so the information is correct.

Note   Object IDs are 64-bit numbers. Allocation starts from one, so zero is never a valid object ID. A formatter can choose a zero value to represent an object reference whose value is a null reference (Nothing in Visual Basic).

Requirements

Namespace: System.Runtime.Serialization

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

ObjectIDGenerator Members | System.Runtime.Serialization Namespace | XML and SOAP Serialization | Formatter

Show:
© 2015 Microsoft