ObjectIDGenerator.GetId Method

Returns the ID for the specified object, generating a new ID if the specified object has not already been identified by the ObjectIDGenerator.

Namespace: System.Runtime.Serialization
Assembly: mscorlib (in mscorlib.dll)

public virtual long GetId (
	Object obj,
	out bool firstTime
public long GetId (
	Object obj, 
	/** @attribute OutAttribute() */ /** @ref */ boolean firstTime
JScript does not support passing value-type arguments by reference.



The object you want an ID for.


true if obj was not previously known to the ObjectIDGenerator; otherwise, false.

Return Value

The object's ID is used for serialization. firstTime is set to true if this is the first time the object has been identified; otherwise, it is set to false.

Exception typeCondition


The obj parameter is a null reference (Nothing in Visual Basic).


The ObjectIDGenerator has been asked to keep track of too many objects.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0