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
indexintThe zero-based index that identifies the handle. Must be greater than or equal to 0.
generationuintThe 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
Index
Gets the zero-based index associated with this instance.
public readonly int Index
Field Value
Methods
Equals(SwiftHandle)
public bool Equals(SwiftHandle other)
Parameters
otherSwiftHandle
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
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
leftSwiftHandlerightSwiftHandle
Returns
operator !=(SwiftHandle, SwiftHandle)
Determines whether two SwiftHandle instances are not equal.
public static bool operator !=(SwiftHandle left, SwiftHandle right)
Parameters
leftSwiftHandlerightSwiftHandle