Collection.Key

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

Collection.Key(index as Integer) As Variant

Supported for all project types and targets.

Refers to the key for an element of a collection. index is 1-based.

Sample Code

The following code fetches some elements in the collection:

Var c As New Collection
c.Add(1, "ID")
c.Add("Lois Lane", "Name")
c.Add("Reporter", "JobTitle")
c.Add(85000, "Salary")
Var name As String = c.Item(2) // returns "Lois Lane"
Var nameKey As String = c.Key(2) // returns "Name"