ObjectIDGenerator::HasId Method (Object^, Boolean%)

 

Determines whether an object has already been assigned an ID.

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

public:
virtual long long HasId(
	Object^ obj,
	[OutAttribute] bool% firstTime
)

Parameters

obj
Type: System::Object^

The object you are asking for.

firstTime
Type: System::Boolean%

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

Return Value

Type: System::Int64

The object ID of obj if previously known to the ObjectIDGenerator; otherwise, zero.

Exception Condition
ArgumentNullException

The obj parameter is null.

If the object has already been assigned an ID, the ID is returned and firstTime is set to false; otherwise, zero is returned and firstTime is set to true. HasId differs from GetId in that it never creates an ID for an object that has not already been seen by the ObjectIDGenerator.

.NET Framework
Available since 1.1
Return to top
Show: