C# ListDictionary Remove

Description

ListDictionary Remove removes the entry with the specified key from the ListDictionary.

Syntax

ListDictionary.Remove has the following syntax.


public void Remove(
  Object key
)

Parameters

ListDictionary.Remove has the following parameters.

  • key - The key of the entry to remove.

Returns

ListDictionary.Remove method returns

Example


using System;//from   ww w  . j ava  2s .  c o m
using System.Collections;
using System.Collections.Specialized;

public class SamplesListDictionary  {
   public static void Main()  {
      ListDictionary myCol = new ListDictionary();
      myCol.Add( "F", "1.49" );
      myCol.Add( "A", "1.29" );
      myCol.Add( "B", "1.49" );
      myCol.Add( "C", "1.29" );
      myCol.Add( "D", "0.89" );
      myCol.Add( "E", "0.99" );

      myCol.Remove( "A" );
      foreach ( DictionaryEntry de in myCol )
         Console.WriteLine( "   {0,-25} {1}", de.Key, de.Value );
      Console.WriteLine();
   }
}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator