Class UniversalIDs
Management of objects with a universal id. Tracks them and allows finding by ID.
Inheritance
System.Object
UniversalIDs
Assembly: Eco.Core.dll
Syntax
public static class UniversalIDs : Object
Properties
AllObjects
Declaration
public static IEnumerable<IHasUniversalID> AllObjects { get; }
Property Value
Methods
ClaimID(IHasUniversalID, Int32)
Claims id
for obj
. Can only be used when serialized IDs loaded and if object doesn't yet have an ID.
Declaration
public static void ClaimID(this IHasUniversalID obj, int id)
Parameters
Clean()
Remove entries whose weak-references no longer point to anything.
Declaration
public static void Clean()
GetOrCreateID(IHasUniversalID)
Get the ID, assigning a new one if none is set yet.
Declaration
public static int GetOrCreateID(this IHasUniversalID obj)
Parameters
Returns
Type |
Description |
System.Int32 |
|
GetOrNull(Int32)
Return the IHasUniversalID with the given ID, or null if it's not found.
Declaration
public static IHasUniversalID GetOrNull(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
GetOrNull<T>(Int32)
Return the object with the given ID, cast to expected Type T. Returns null if not found or different type than expected.
Declaration
public static T GetOrNull<T>(int id)
where T : class, IHasUniversalID
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type Parameters
Load(IEnumerable<IHasUniversalID>)
Declaration
public static void Load(IEnumerable<IHasUniversalID> objs)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IHasUniversalID> |
objs |
|
Remove(IHasUniversalID)
Declaration
public static void Remove(IHasUniversalID obj)
Parameters
TryGetByID(Int32, out IHasUniversalID)
Get the object of the given ID. It may fail if the weak reference has expired on a deleted object,
in which case false is returned.
Declaration
public static bool TryGetByID(int id, out IHasUniversalID val)
Parameters
Returns
Type |
Description |
System.Boolean |
|