using
System;
using
System.Collections;
using
System.Collections.Specialized;
class
GFG {
public
static
void
Main()
{
StringDictionary myDict =
new
StringDictionary();
myDict.Add(
"A"
,
"Apple"
);
myDict.Add(
"B"
,
"Banana"
);
myDict.Add(
"C"
,
"Cat"
);
myDict.Add(
"D"
,
"Dog"
);
myDict.Add(
"E"
,
"Elephant"
);
myDict.Add(
"F"
,
"Fish"
);
Console.WriteLine(
"The number of key/value pairs are : "
+ myDict.Count);
foreach
(DictionaryEntry dic
in
myDict)
{
Console.WriteLine(dic.Key +
" "
+ dic.Value);
}
myDict.Clear();
Console.WriteLine(
"The number of key/value pairs are : "
+ myDict.Count);
foreach
(DictionaryEntry dic
in
myDict)
{
Console.WriteLine(dic.Key +
" "
+ dic.Value);
}
}
}