Struct EntityLink<T>
Typed entity reference — an 8-byte wrapper around EntityId that provides compile-time archetype safety. An EntityLink<T> accepts Building, House, or any descendant archetype.
public readonly struct EntityLink<T> : IEquatable<EntityLink<T>> where T : class
Type Parameters
TThe target archetype type (or ancestor for polymorphic references).
- Implements
-
IEquatable<EntityLink<T>>
- Inherited Members
Fields
Null
The null link sentinel.
public static readonly EntityLink<T> Null
Field Value
- EntityLink<T>
Properties
Id
The underlying EntityId.
public EntityId Id { get; }
Property Value
IsNull
True if this link points to no entity.
public bool IsNull { get; }
Property Value
Methods
Equals(object)
Returns true when obj is an EntityLink<T> equal to this one.
public override bool Equals(object obj)
Parameters
objobject
Returns
Equals(EntityLink<T>)
public bool Equals(EntityLink<T> other)
Parameters
otherEntityLink<T>
Returns
GetHashCode()
Hash of the underlying EntityId.
public override int GetHashCode()
Returns
ToString()
Human-readable form, e.g. EntityLink<Building>(...), or the null form for an empty link.
public override string ToString()
Returns
Operators
operator ==(EntityLink<T>, EntityLink<T>)
Value equality of two typed links (compares the underlying EntityId).
public static bool operator ==(EntityLink<T> left, EntityLink<T> right)
Parameters
leftEntityLink<T>rightEntityLink<T>
Returns
implicit operator EntityLink<T>(EntityId)
Wraps a raw EntityId as a typed link; no archetype compatibility check is performed.
public static implicit operator EntityLink<T>(EntityId id)
Parameters
idEntityId
Returns
- EntityLink<T>
implicit operator EntityId(EntityLink<T>)
Unwraps the link to its underlying EntityId.
public static implicit operator EntityId(EntityLink<T> link)
Parameters
linkEntityLink<T>
Returns
operator !=(EntityLink<T>, EntityLink<T>)
Value inequality of two typed links (compares the underlying EntityId).
public static bool operator !=(EntityLink<T> left, EntityLink<T> right)
Parameters
leftEntityLink<T>rightEntityLink<T>