Struct SwiftTicket
- Namespace
- SwiftCollections
- Assembly
- SwiftCollections.dll
Identifies an allocation in its originating ticket map by index and generation.
public readonly struct SwiftTicket : IEquatable<SwiftTicket>
- Implements
- Inherited Members
Remarks
A SwiftTicket consists of an integer index and an unsigned generation value. This combination helps detect stale references when slots are reused. Tickets carry no collection identity; use them only with their originating map. Generation counters are finite.
Constructors
SwiftTicket(int, uint)
Initializes a new instance of the SwiftTicket class with the specified index and generation values.
public SwiftTicket(int index, uint generation)
Parameters
indexintThe zero-based index that identifies the ticket. Must be greater than or equal to 0.
generationuintThe generation value associated with the ticket. 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(SwiftTicket)
public bool Equals(SwiftTicket other)
Parameters
otherSwiftTicket
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 ticket, including its index and generation values.
public override string ToString()
Returns
- string
A string in the format "Ticket({Index}:{Generation})" that identifies the ticket by its index and generation.
Operators
operator ==(SwiftTicket, SwiftTicket)
Determines whether two SwiftTicket instances are equal.
public static bool operator ==(SwiftTicket left, SwiftTicket right)
Parameters
leftSwiftTicketrightSwiftTicket
Returns
operator !=(SwiftTicket, SwiftTicket)
Determines whether two SwiftTicket instances are not equal.
public static bool operator !=(SwiftTicket left, SwiftTicket right)
Parameters
leftSwiftTicketrightSwiftTicket