Sitecore 5.1.1 API

HashList.Item Property (String)

Gets or sets an object by its key.

[Visual Basic]
Overloads Public Default Property Item( _
   ByVal sKey As String _
) As Object
[C#]
public object this[
   string sKey
] {get; set;}

Parameters

sKey
A key.

Property Value

Gets the object which is associated with a key.

Remarks

If the key does not exist, null is returned.

Example

  Hashtable hashTable = new Hashtable();
  hashTable.Add("0", "apples");
  hashTable.Add("1", "bananas");
  hashTable.Add("2", "pears");
  
  string bananas = hashTable[1]; // returns "bananas"
  string apples = hashTable["0"]; // returns "apples"

See Also

HashList Class | Sitecore.Collections Namespace | HashList.Item Overload List