Key

Returns and sets a string that uniquely identifies a member in a collection.

Syntax

object.Key [= string]

Parameters

object
Object expression that evaluates to a member in a collection.
string
String that uniquely identifies a member in a collection.

Remarks

You can set the Key property when you use the Add method to add an object to a collection.

If you expect the Index property to change dynamically, refer to objects in a collection using the Key property.

In addition, you can use the Key property to make your Windows CE project self-documenting by assigning meaningful names to the objects in a collection.

If the string is not unique, an error will occur.