Sitecore 5.0 API

HashList.IndexOf Method 

Gets the index of a key.

[Visual Basic]
Public Function IndexOf( _
   ByVal key As String _
) As Integer
[C#]
public int IndexOf(
   string key
);

Parameters

key
A key.

Return Value

The index of the key. If the key is not found, -1 is returned.

Example

  Hashtable hashTable = new Hashtable();
  hashTable.Add("0", "apples");
  hashTable.Add("1", "bananas");
  hashTable.Add("2", "pears");
  
  int bananaKey = hashTable.IndexOf("1");

See Also

HashList Class | Sitecore.Collections Namespace