Remove the entry with the specified key from the string dictionary in CSharp
Description
The following code shows how to remove the entry with the specified key from the string dictionary.
Example
using System;//w w w . j av a 2s . com
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" );
foreach ( DictionaryEntry de in myCol ){
Console.WriteLine(de.Key +" "+ de.Value );
}
}
}
The code above generates the following result.