Table of Contents

Struct SwiftHandle

Namespace
SwiftCollections
Assembly
SwiftCollections.dll

Represents a value type handle that uniquely identifies an object or resource by index and generation.

public readonly struct SwiftHandle : IEquatable<SwiftHandle>
Implements
Inherited Members

Remarks

A SwiftHandle consists of an integer index and an unsigned generation value. This combination helps detect stale or invalid references when resources are recycled.

Constructors

SwiftHandle(int, uint)

Initializes a new instance of the SwiftHandle class with the specified index and generation values.

public SwiftHandle(int index, uint generation)

Parameters

index int

The zero-based index that identifies the handle. Must be greater than or equal to 0.

generation uint

The generation value associated with the handle. Used to distinguish between different versions of the same index.

Fields

Generation

Gets the generation number associated with this instance.

public readonly uint Generation

Field Value

uint

Index

Gets the zero-based index associated with this instance.

public readonly int Index

Field Value

int

Methods

Equals(SwiftHandle)

public bool Equals(SwiftHandle other)

Parameters

other SwiftHandle

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

Returns a string that represents the current handle, including its index and generation values.

public override string ToString()

Returns

string

A string in the format "Handle({Index}:{Generation})" that identifies the handle by its index and generation.

Operators

operator ==(SwiftHandle, SwiftHandle)

Determines whether two SwiftHandle instances are equal.

public static bool operator ==(SwiftHandle left, SwiftHandle right)

Parameters

left SwiftHandle
right SwiftHandle

Returns

bool

operator !=(SwiftHandle, SwiftHandle)

Determines whether two SwiftHandle instances are not equal.

public static bool operator !=(SwiftHandle left, SwiftHandle right)

Parameters

left SwiftHandle
right SwiftHandle

Returns

bool