C# OrderedDictionary Item[Object]

Description

OrderedDictionary Item[Object] gets or sets the value with the specified key.

Syntax

OrderedDictionary.Item[Object] has the following syntax.


public Object this[
  Object key
] { get; set; }

Parameters

OrderedDictionary.Item[Object] has the following parameters.

  • key - The key of the value to get or set.

Example


using System;/* w  ww . j  av  a2 s  .  c om*/
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringCollection  {

   public static void Main()  {
        OrderedDictionary myOrderedDictionary = new OrderedDictionary();
        myOrderedDictionary.Add("testKey1", "testValue1");
        myOrderedDictionary.Add("testKey2", "testValue2");
        myOrderedDictionary.Add("keyToDelete", "valueToDelete");
        myOrderedDictionary.Add("testKey3", "testValue3");
        Console.WriteLine( myOrderedDictionary["keyToDelete"]);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator