Xojo 2015
So I have a collection.
It ruddy should have a key property, here are the Xojo docs:
[quote]Collection.Key Method
Collection.Key(index as Integer) As Variant
Refers to the key for an element of a collection. index is 1-based.
Example
The following example fetches some elements in the collection:
Dim c As New Collection
c.Add(1, “ID”)
c.Add(“Lois Lane”, “Name”)
c.Add(“Reporter”, “JobTitle”)
c.Add(85000, “Salary”)
Dim name As String = c.Item(2) // returns “Lois Lane”
Dim nameKey As String = c.Key(2) // returns “Name”[/quote]
But sure enough… Dim mycoll as new collection
mycoll.
…(tabs)…
no autocomplete for key
I get item, count, add, and remove
In the debugger, my collection appears as a list of pairs
There is a left and a right, but these are not properties of a collection either
Whats going on?
The change history for the docs entry show that the Key method was added September 2016 which coincides with the 2016r3 release. Check the release notes to be sure, but using the documentation change history (one great reason to use the wiki-docs) it looks like the feature didn’t exist in 2015.
I was under the same impression. Though when testing 2017r3 is not flagging it as deprecated. The documentation does include a note recommending the use of a Dictionary. They also say this: “The Collection class is included mainly for backward compatibility and for conversion of Visual Basic projects.”