|
Enhanced C#
Loyc library documentation
|
Assigns a unique long ID (starting at 1) to each distinct object reference presented to it.
More...
Assigns a unique long ID (starting at 1) to each distinct object reference presented to it.
This is a drop-in replacement for System.Runtime.Serialization.ObjectIDGenerator, which Microsoft marked obsolete in .NET 8 (SYSLIB0050, "Formatter-based serialization
is obsolete and should not be used"). The observable behaviour is the same: IDs are assigned sequentially starting at 1, objects are compared by reference identity, and GetId reports whether the object had been seen before.
Public Member Functions | |
| long | GetId (object obj, out bool firstTime) |
| Gets the ID of obj , assigning a new one if this is the first time the object has been seen. More... | |
| long | HasId (object obj, out bool firstTime) |
| Returns the ID previously assigned to obj , or 0 if the object has not been seen. Does not assign a new ID. More... | |
|
inline |
Gets the ID of obj , assigning a new one if this is the first time the object has been seen.
| firstTime | Set to true if a new ID was assigned. |
| ArgumentNullException | obj was null. |
|
inline |
Returns the ID previously assigned to obj , or 0 if the object has not been seen. Does not assign a new ID.
1.8.7