Skip to content

KernelAPI reference

Struct Handle<T\>

Namespace: MicroEngine.Kernel
Assembly: MicroEngine.Kernel.dll
Guide: Modules and the frame schedule

A reference to an item of a HandlePool`1: a slot index and the generation of the item that held the slot when the handle was made. When the item is removed its slot’s generation changes, so an old handle no longer finds anything (instead of finding whatever reuses the slot). default is None.

C#
public readonly struct Handle<T> : IEquatable<Handle<T>>

Type Parameters

T

The kind of item, so handles of different pools cannot be mixed up.

Implements

IEquatable<Handle<T>>

Constructors

Handle(int, uint)

A reference to an item of a HandlePool`1: a slot index and the generation of the item that held the slot when the handle was made. When the item is removed its slot’s generation changes, so an old handle no longer finds anything (instead of finding whatever reuses the slot). default is None.

C#
public Handle(int Index, uint Generation)

Parameters

Index int

The slot.

Generation uint

The generation of the slot’s item; 0 only for None.

Properties

Generation

The generation of the slot’s item; 0 only for None.

C#
public uint Generation { get; init; }

Property Value

uint

Index

The slot.

C#
public int Index { get; init; }

Property Value

int

IsNone

Whether this is None.

C#
public bool IsNone { get; }

Property Value

bool

None

The handle of nothing.

C#
public static Handle<T> None { get; }

Property Value

Handle<T>

Methods

Deconstruct(out int, out uint)

C#
public void Deconstruct(out int Index, out uint Generation)

Parameters

Index int

Generation uint

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(Handle<T>)

C#
public bool Equals(Handle<T> other)

Parameters

other Handle<T>

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(Handle<T>, Handle<T>)

C#
public static bool operator ==(Handle<T> left, Handle<T> right)

Parameters

left Handle<T>

right Handle<T>

Returns

bool

operator !=(Handle<T>, Handle<T>)

C#
public static bool operator !=(Handle<T> left, Handle<T> right)

Parameters

left Handle<T>

right Handle<T>

Returns

bool