Remove the entry at the specified index from the OrderedDictionary collection in CSharp

Description

The following code shows how to remove the entry at the specified index from the OrderedDictionary collection.

Example


using System;/*  w ww.ja  v a 2s.  co  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.RemoveAt(myOrderedDictionary.Count - 1);
    
        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