C# StringDictionary Remove

Description

StringDictionary Remove removes the entry with the specified key from the string dictionary.

Syntax

StringDictionary.Remove has the following syntax.


public virtual void Remove(
  string key
)

Parameters

StringDictionary.Remove has the following parameters.

  • key - The key of the entry to remove.

Returns

StringDictionary.Remove method returns

Example

The following code example demonstrates how to add and remove elements from a StringDictionary.


/*from ww w  .  java  2  s.  c  o  m*/
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringDictionary  {

   public static void Main()  {
      StringDictionary myCol = new StringDictionary();
      myCol.Add( "red", "rojo" );
      myCol.Add( "green", "verde" );
      myCol.Add( "blue", "azul" );

      myCol.Remove( "green" );
      Console.WriteLine( "   KEY        VALUE" );
      foreach ( DictionaryEntry de in myCol )
         Console.WriteLine( "   {0,-10} {1}", de.Key, de.Value );
   }
}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator