Remove the entry with the specified key from the OrderedDictionary in CSharp

Description

The following code shows how to remove the entry with the specified key from the OrderedDictionary.

Example


using System;//  w w w.ja  v a2  s.c o  m
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("testKey3", "testValue3");

        myOrderedDictionary.Remove("testKey3");
        
        Console.WriteLine(myOrderedDictionary.Contains("testKey3"));
        
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary